Submission #3398365
Source Code Expand
//In The Name of Beauty #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef map<ll,ll> mllll; #define IB std::ios::sync_with_stdio(0); #define pb(x) push_back(x); #define mp(x,y) make_pair(x,y) #define pll pair<ll,ll> #define F first #define S second #define trvall(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) #define MAXN (ll)1e5 + 8 #define INF (ll)1e12 + 8 ll const delta = 1000000007; ll a[1000]; int main() { IB; cin.tie(0); cout.tie(0); ll n; cin >> n; ll ans = 0; for(ll i = 0;i < n;i++) { cin >> a[i]; } ll temp = 0 , i = 0; while(i < n) { temp = 0; while(a[i] == a[i + 1] && i < n) { temp++; i++; } temp++; ans += (temp / 2); i++; } cout << ans; return 0; } //Written by M_H_H_7
Submission Info
Submission Time | |
---|---|
Task | A - Colorful Slimes 2 |
User | M_H_H_7 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 993 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_0, example_1, example_2, example_3 |
All | example_0, example_1, example_2, example_3, handmade_0, handmade_1, rand_0, rand_1, smallcolor_0, smallcolor_1, smallcolor_2, smallcolor_3, smallcolor_4 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_0 | AC | 1 ms | 256 KB |
example_1 | AC | 1 ms | 256 KB |
example_2 | AC | 1 ms | 256 KB |
example_3 | AC | 1 ms | 256 KB |
handmade_0 | AC | 1 ms | 256 KB |
handmade_1 | AC | 1 ms | 256 KB |
rand_0 | AC | 1 ms | 256 KB |
rand_1 | AC | 1 ms | 256 KB |
smallcolor_0 | AC | 1 ms | 256 KB |
smallcolor_1 | AC | 1 ms | 256 KB |
smallcolor_2 | AC | 1 ms | 256 KB |
smallcolor_3 | AC | 1 ms | 256 KB |
smallcolor_4 | AC | 1 ms | 256 KB |