# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
555254 | 2022-04-30T10:36:39 Z | nafis_shifat | 송금 (JOI19_remittance) | C++17 | 298 ms | 28404 KB |
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> using namespace std; const int mxn=1e6+5; const int inf=1e9; int a[mxn], b[mxn]; int n; void process() { for(int i = 0; i < n; i++) { int nxt = (i + 1) % n; int rem = (a[i] - b[i]) / 2; if(rem <= 0) continue; a[nxt] += rem; a[i] -= 2 * rem; } } int main() { cin >> n; ll bs = 0; ll as = 0; for(int i = 0; i < n; i++) { scanf("%d%d", &a[i], &b[i]); bs += b[i]; as += a[i]; } if(as && !bs) { cout<<"No"<<endl; return 0; } for(int i = 0; i < 60; i++) process(); bool f1 = true, f2 = true; for(int i = 0; i < n; i++) { f1 = f1 && (a[i] == b[i]); f2 = f2 && (a[i] == b[i] + 1); } if(f1 || f2) cout<<"Yes"<<endl; else cout<<"No"<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 312 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 308 KB | Output is correct |
14 | Correct | 0 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 312 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 312 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 308 KB | Output is correct |
14 | Correct | 0 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 312 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 0 ms | 212 KB | Output is correct |
33 | Correct | 0 ms | 308 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 1 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 0 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 1 ms | 304 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 0 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 0 ms | 212 KB | Output is correct |
47 | Correct | 0 ms | 312 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 0 ms | 212 KB | Output is correct |
51 | Correct | 1 ms | 212 KB | Output is correct |
52 | Correct | 0 ms | 212 KB | Output is correct |
53 | Correct | 0 ms | 212 KB | Output is correct |
54 | Correct | 0 ms | 212 KB | Output is correct |
55 | Correct | 1 ms | 212 KB | Output is correct |
56 | Correct | 1 ms | 212 KB | Output is correct |
57 | Correct | 0 ms | 212 KB | Output is correct |
58 | Correct | 1 ms | 212 KB | Output is correct |
59 | Correct | 1 ms | 212 KB | Output is correct |
60 | Correct | 0 ms | 212 KB | Output is correct |
61 | Correct | 1 ms | 212 KB | Output is correct |
62 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 312 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 308 KB | Output is correct |
14 | Correct | 0 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 312 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 0 ms | 212 KB | Output is correct |
33 | Correct | 0 ms | 308 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 1 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 0 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 1 ms | 304 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 0 ms | 212 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 0 ms | 212 KB | Output is correct |
47 | Correct | 0 ms | 312 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 0 ms | 212 KB | Output is correct |
51 | Correct | 1 ms | 212 KB | Output is correct |
52 | Correct | 0 ms | 212 KB | Output is correct |
53 | Correct | 0 ms | 212 KB | Output is correct |
54 | Correct | 0 ms | 212 KB | Output is correct |
55 | Correct | 1 ms | 212 KB | Output is correct |
56 | Correct | 1 ms | 212 KB | Output is correct |
57 | Correct | 0 ms | 212 KB | Output is correct |
58 | Correct | 1 ms | 212 KB | Output is correct |
59 | Correct | 1 ms | 212 KB | Output is correct |
60 | Correct | 0 ms | 212 KB | Output is correct |
61 | Correct | 1 ms | 212 KB | Output is correct |
62 | Correct | 0 ms | 212 KB | Output is correct |
63 | Correct | 298 ms | 27384 KB | Output is correct |
64 | Correct | 231 ms | 12108 KB | Output is correct |
65 | Correct | 283 ms | 27060 KB | Output is correct |
66 | Correct | 217 ms | 11980 KB | Output is correct |
67 | Correct | 209 ms | 13308 KB | Output is correct |
68 | Correct | 219 ms | 15800 KB | Output is correct |
69 | Correct | 286 ms | 27456 KB | Output is correct |
70 | Correct | 212 ms | 11980 KB | Output is correct |
71 | Correct | 203 ms | 13320 KB | Output is correct |
72 | Correct | 208 ms | 15788 KB | Output is correct |
73 | Correct | 277 ms | 27500 KB | Output is correct |
74 | Correct | 216 ms | 11948 KB | Output is correct |
75 | Correct | 204 ms | 13364 KB | Output is correct |
76 | Correct | 218 ms | 15780 KB | Output is correct |
77 | Correct | 294 ms | 27360 KB | Output is correct |
78 | Correct | 172 ms | 19708 KB | Output is correct |
79 | Correct | 214 ms | 19660 KB | Output is correct |
80 | Correct | 231 ms | 19624 KB | Output is correct |
81 | Correct | 242 ms | 19640 KB | Output is correct |
82 | Correct | 131 ms | 11920 KB | Output is correct |
83 | Correct | 188 ms | 11984 KB | Output is correct |
84 | Correct | 203 ms | 11916 KB | Output is correct |
85 | Correct | 293 ms | 28400 KB | Output is correct |
86 | Correct | 285 ms | 28404 KB | Output is correct |
87 | Correct | 172 ms | 20764 KB | Output is correct |
88 | Correct | 245 ms | 20736 KB | Output is correct |