# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321266 | 2020-11-11T19:21:38 Z | CaroLinda | Remittance (JOI19_remittance) | C++14 | 1 ms | 364 KB |
#include <bits/stdc++.h> const int MAX = 1e6+10 ; using namespace std ; int n ; long long cash[MAX] , desired[MAX] ; int main() { scanf("%d", &n ) ; for(int i= 0 ; i < n ; i++ ) scanf("%lld %lld", &cash[i] , &desired[i] ) ; for(int g = 0 ; g < 60 ; g++ ) { for(int i= 0 , nxt = 1 ; i < n ; i++ , nxt++ ) { if(nxt == n) nxt = 0 ; long long leftOver = cash[i] - desired[i] ; if(leftOver < 0 ) continue ; cash[i] -= (leftOver/2LL ) *2LL ; cash[nxt] += leftOver/2LL ; } } bool ok =true ; for(int i= 0 ; i < n ; i++ ) if(cash[i] != desired[i] ) ok = false ; if(ok) printf("Yes\n") ; else printf("No\n") ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Incorrect | 1 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Incorrect | 1 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Incorrect | 1 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |