Submission #3392397


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
const int inf=1e9+7;
const int mod=1e9+7;
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
int main(){
	int N;
	int A[100];
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	int ans=0;
	int idx=0;
	while(idx<N){
		int cnt=1;
		while(idx+1<N&&A[idx]==A[idx+1]){
			idx++;
			cnt++;
		}
		ans+=(cnt-cnt%2)/2;
		idx++;
	}
	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 677 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

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