Submission #3027401


Source Code Expand

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>	
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound          	
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcount                                                                                        
#define sqr(x) ((x) * (x))
#define al 0x3F3F3F3F
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;                                  
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;
                                       
const double pi = acos(-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};   																																					
const int dy[] = {0, 1, 0, -1, 0};  

int n, j, a[N], ans;

inline void boost () {
	ios_base :: sync_with_stdio (NULL);
	cin.tie (NULL), cout.tie (NULL);
}

inline void Solve () {  
	boost (); 
	cin >> n;
	for (int i = 1; i <= n; i ++) cin >> a[i];
	for (int i = 1; i <= n; i = j) {
		j = i;
		while (j <= n && a[i] == a[j]) j ++;
		ans += (j - i) / 2;
	}
	cout << ans;
}                                          
                  
main () {                                       
//	freopen ("ormax.in", "r", stdin);    
//	freopen ("ormax.out", "w", stdout); 	          
	int tt = 1;
//	cin >> tt;   
	while (tt --) {
		Solve ();
	}        
	return 0;      
}                                                  

Submission Info

Submission Time
Task A - Colorful Slimes 2
User ChiffChaff
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1840 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 13
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