Submission #3413114
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <numeric> #include <set> #include <map> #include <stack> #include <queue> #include <time.h> #include <list> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);++i) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define reps(x,c) for(auto x:c) #define all(x) begin(x), end(x) #define pb(a) emplace_back(a) #define mp(a,b) make_pair((a),(b)) #define pl pair<ll,ll> #define INF 2147483600 #define fi first #define se second #define dbg(x) cout << #x"="<< (x) << endl #define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } int main(){ ll n;cin>>n; std::vector<ll> a(n+1);rep(i,n)cin>>a[i]; ll ans=0,num=0; rep(i,n){ if(a[i+1]==a[i]){ num++; }else{ num++; ans+=num/2; num=0; } } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Colorful Slimes 2 |
User | motigome |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 934 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 |