Contest Duration: - (local time) (110 minutes) Back to Home

Submission #844968

Source Code Expand

Copy
```#include <bits/stdc++.h>

#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using ll=long long;
ll a[100010];

int main(void){
int n;
cin >> n;
rep(i,n) cin >> a[i];

ll ans=0LL;
rep(i,1,n){
ll sum=(a[i]+a[i-1]);
ll cnt=sum/2LL;
ans+=cnt;

if(sum%2==1){
if(a[i]==0)
a[i-1]=1LL;
else
a[i]=1LL;
}else
a[i-1]=a[i]=0LL;
}

cout << ans << endl;
return 0;
}```

#### Submission Info

Submission Time 2016-08-21 21:09:32+0900 B - Simplified mahjong Hec C++14 (GCC 5.4.1) 0 1197 Byte WA 130 ms 1024 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
 AC × 2
 AC × 23 WA × 1
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt AC 113 ms 1024 KB
02.txt AC 118 ms 1024 KB
03.txt AC 119 ms 1024 KB
04.txt AC 67 ms 1024 KB
05.txt AC 77 ms 1024 KB
06.txt AC 76 ms 1024 KB
07.txt AC 101 ms 1024 KB
08.txt AC 101 ms 1024 KB
09.txt AC 120 ms 1024 KB
10.txt AC 118 ms 1024 KB
11.txt AC 33 ms 1024 KB
12.txt AC 130 ms 1024 KB
13.txt AC 119 ms 1024 KB
14.txt AC 119 ms 1024 KB
15.txt AC 35 ms 1024 KB
16.txt AC 117 ms 1024 KB
17.txt AC 118 ms 1024 KB
18.txt AC 4 ms 256 KB
19.txt AC 4 ms 256 KB
20.txt WA 4 ms 256 KB
21.txt AC 4 ms 256 KB
22.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB