Submission #2844211


Source Code Expand

Copy
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
struct poi{
	int X;int Y;int Z;
	bool operator<(const poi&R)const{
		return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
	}
};
//
ll GCD(ll a,ll b){
	return (b==0)?(a):(GCD(b,a%b));
}
ll LCM(ll a,ll b){
	return a/GCD(a,b)*b;
}
//
int main(){
	int N;
	int A[100];
	cin>>N;
	FOR(i,0,N){
		cin>>A[i];
	}
	int ans=0;
	int now=0;
	while(now<N){
		int c=1;
		while(now<N-1&&A[now]==A[now+1]){
			now++;
			c++;
		}
		now++;
		ans+=c/2;
	}
	cout<<ans<<endl;
	return 0;
}

Submission Info

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

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0, example_1, example_2, example_3
All 200 / 200 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 1 ms 256 KB
example_1 1 ms 256 KB
example_2 1 ms 256 KB
example_3 1 ms 256 KB
handmade_0 1 ms 256 KB
handmade_1 1 ms 256 KB
rand_0 1 ms 256 KB
rand_1 1 ms 256 KB
smallcolor_0 1 ms 256 KB
smallcolor_1 1 ms 256 KB
smallcolor_2 1 ms 256 KB
smallcolor_3 1 ms 256 KB
smallcolor_4 1 ms 256 KB