# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200791 | 2020-02-08T07:25:43 Z | dennisstar | Remittance (JOI19_remittance) | C++17 | 7 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; int N, A[1000010], B[1000010], D[1000010]; int main() { scanf("%d", &N); for (int i=0; i<N; i++) scanf("%d %d", &A[i], &B[i]), D[i]=A[i]-B[i]; for (int p=0; p<32; p++) for (int i=0; i<N; i++) if (D[i]>0) { int x=min(D[i]/2, A[i]/2); A[i]-=x*2, D[i]-=x*2; A[(i+1)%N]+=x, D[(i+1)%N]+=x; } for (int i=0; i<N; i++) if (A[i]!=B[i]) { puts("No"); return 0; } puts("Yes"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 7 ms | 380 KB | Output is correct |
8 | Incorrect | 5 ms | 376 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 7 ms | 380 KB | Output is correct |
8 | Incorrect | 5 ms | 376 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 7 ms | 380 KB | Output is correct |
8 | Incorrect | 5 ms | 376 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |