# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
211627 | 2020-03-20T20:52:50 Z | m3r8 | Remittance (JOI19_remittance) | C++14 | 7 ms | 384 KB |
#include <stdio.h> #define N 1000100 #define ll long long ll A[N]; ll B[N]; int cnt[N]; int main(void){ int n; int nn = 1; int nnn = 1; scanf("%d",&n); for(int i = 0;i<n;i++){ scanf("%lld %lld",&A[i],&B[i]); if(B[i] != 0)nn = 0; if(A[i] != 0)nnn = 0; }; int pos = 1; if(nn && !nnn)pos = 0; if(pos){ for(int j = 0;j<2;j++){ for(int i = 0;i<n;i++){ if(j == 1 && i == n-1)break; if(A[i] > B[i]){ ll tmp = A[i]-B[i]; if(tmp % 2)tmp--; tmp /= 2; A[(i+1)%n] += tmp; A[i] -= tmp * 2; }; }; }; for(int i = 0;i<n;i++){ ll diff = A[i]-B[i]; pos = diff >= 0; if(!pos)break; for(int j = 0;j<32;j++){ if(diff & (1ull << j)){ cnt[(i+j)%n] ^= 1; }; }; }; }; if(pos){ int st = cnt[0]; for(int i = 0;i<n;i++){ //printf("%lld\n",A[i]-B[i]); //printf("%d\n",cnt[i]); if(cnt[i] != st){ pos = 0; break; }; }; }; if(pos)printf("Yes\n"); else printf("No\n"); return 0; };
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 256 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 4 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 4 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 4 ms | 256 KB | Output is correct |
21 | Correct | 4 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 4 ms | 384 KB | Output is correct |
24 | Correct | 4 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 4 ms | 256 KB | Output is correct |
27 | Correct | 5 ms | 256 KB | Output is correct |
28 | Correct | 4 ms | 256 KB | Output is correct |
29 | Correct | 4 ms | 256 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 7 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 256 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 4 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 4 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 4 ms | 256 KB | Output is correct |
21 | Correct | 4 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 4 ms | 384 KB | Output is correct |
24 | Correct | 4 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 4 ms | 256 KB | Output is correct |
27 | Correct | 5 ms | 256 KB | Output is correct |
28 | Correct | 4 ms | 256 KB | Output is correct |
29 | Correct | 4 ms | 256 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 7 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 256 KB | Output is correct |
33 | Correct | 4 ms | 256 KB | Output is correct |
34 | Correct | 4 ms | 256 KB | Output is correct |
35 | Correct | 4 ms | 256 KB | Output is correct |
36 | Correct | 4 ms | 256 KB | Output is correct |
37 | Correct | 4 ms | 256 KB | Output is correct |
38 | Correct | 5 ms | 256 KB | Output is correct |
39 | Correct | 6 ms | 384 KB | Output is correct |
40 | Correct | 4 ms | 384 KB | Output is correct |
41 | Correct | 5 ms | 256 KB | Output is correct |
42 | Incorrect | 4 ms | 256 KB | Output isn't correct |
43 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 4 ms | 256 KB | Output is correct |
4 | Correct | 4 ms | 256 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 256 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 4 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 4 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 4 ms | 256 KB | Output is correct |
21 | Correct | 4 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 4 ms | 384 KB | Output is correct |
24 | Correct | 4 ms | 384 KB | Output is correct |
25 | Correct | 4 ms | 384 KB | Output is correct |
26 | Correct | 4 ms | 256 KB | Output is correct |
27 | Correct | 5 ms | 256 KB | Output is correct |
28 | Correct | 4 ms | 256 KB | Output is correct |
29 | Correct | 4 ms | 256 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 7 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 256 KB | Output is correct |
33 | Correct | 4 ms | 256 KB | Output is correct |
34 | Correct | 4 ms | 256 KB | Output is correct |
35 | Correct | 4 ms | 256 KB | Output is correct |
36 | Correct | 4 ms | 256 KB | Output is correct |
37 | Correct | 4 ms | 256 KB | Output is correct |
38 | Correct | 5 ms | 256 KB | Output is correct |
39 | Correct | 6 ms | 384 KB | Output is correct |
40 | Correct | 4 ms | 384 KB | Output is correct |
41 | Correct | 5 ms | 256 KB | Output is correct |
42 | Incorrect | 4 ms | 256 KB | Output isn't correct |
43 | Halted | 0 ms | 0 KB | - |