# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1102154 | 2024-10-17T14:49:55 Z | ro9669 | 송금 (JOI19_remittance) | C++17 | 642 ms | 36476 KB |
#include <bits/stdc++.h> #define fi first #define se second #define all(v) v.begin() , v.end() #define sz(v) int(v.size()) #define unq(v) sort(all(v)); v.resize(unique(all(v)) - v.begin()); using namespace std; typedef long long ll; typedef pair<int , int> ii; typedef pair<long long , int> lli; const int maxN = int(1e6)+7; int n; ll a[maxN] , b[maxN]; bool check(){ for (int i = 0 ; i < n ; i++){ if (a[i] != b[i]) return 0; } return 1; } void solve(){ cin >> n; for (int i = 0 ; i < n ; i++){ cin >> a[i] >> b[i]; } for (int t = 0 ; t < 100 ; t++){ for (int i = 0 ; i < n ; i++){ if (a[i] >= b[i]){ ll x = (a[i] - b[i]) / 2; a[i] -= 2 * x; a[(i + 1) % n] += x; } } } for (int i = 0 ; i < n ; i++){ if (a[i] < b[i]){ cout << "No\n"; return; } } if (check()){ cout << "Yes\n"; return; } bool ok = 0; for (int i = 0 ; i < n ; i++){ if (a[i] == b[i]){ cout << "No\n"; return; } if (a[i] > 1) ok = 1; } if (ok) cout << "Yes\n"; else cout << "No\n"; } #define name "A" int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(name".INP" , "r")){ freopen(name".INP" , "r" , stdin); freopen(name".OUT" , "w" , stdout); } int t = 1; //cin >> t; while (t--) solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2384 KB | Output is correct |
6 | Correct | 1 ms | 2556 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2384 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2384 KB | Output is correct |
14 | Correct | 1 ms | 2384 KB | Output is correct |
15 | Correct | 1 ms | 2552 KB | Output is correct |
16 | Correct | 1 ms | 2656 KB | Output is correct |
17 | Correct | 1 ms | 2384 KB | Output is correct |
18 | Correct | 1 ms | 2384 KB | Output is correct |
19 | Correct | 1 ms | 2384 KB | Output is correct |
20 | Correct | 1 ms | 2512 KB | Output is correct |
21 | Correct | 1 ms | 2388 KB | Output is correct |
22 | Correct | 1 ms | 2552 KB | Output is correct |
23 | Correct | 2 ms | 2388 KB | Output is correct |
24 | Correct | 1 ms | 2388 KB | Output is correct |
25 | Correct | 1 ms | 2388 KB | Output is correct |
26 | Correct | 1 ms | 2388 KB | Output is correct |
27 | Correct | 1 ms | 2388 KB | Output is correct |
28 | Correct | 1 ms | 2392 KB | Output is correct |
29 | Correct | 1 ms | 2400 KB | Output is correct |
30 | Correct | 1 ms | 2552 KB | Output is correct |
31 | Correct | 1 ms | 2388 KB | Output is correct |
32 | Correct | 1 ms | 2388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2384 KB | Output is correct |
6 | Correct | 1 ms | 2556 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2384 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2384 KB | Output is correct |
14 | Correct | 1 ms | 2384 KB | Output is correct |
15 | Correct | 1 ms | 2552 KB | Output is correct |
16 | Correct | 1 ms | 2656 KB | Output is correct |
17 | Correct | 1 ms | 2384 KB | Output is correct |
18 | Correct | 1 ms | 2384 KB | Output is correct |
19 | Correct | 1 ms | 2384 KB | Output is correct |
20 | Correct | 1 ms | 2512 KB | Output is correct |
21 | Correct | 1 ms | 2388 KB | Output is correct |
22 | Correct | 1 ms | 2552 KB | Output is correct |
23 | Correct | 2 ms | 2388 KB | Output is correct |
24 | Correct | 1 ms | 2388 KB | Output is correct |
25 | Correct | 1 ms | 2388 KB | Output is correct |
26 | Correct | 1 ms | 2388 KB | Output is correct |
27 | Correct | 1 ms | 2388 KB | Output is correct |
28 | Correct | 1 ms | 2392 KB | Output is correct |
29 | Correct | 1 ms | 2400 KB | Output is correct |
30 | Correct | 1 ms | 2552 KB | Output is correct |
31 | Correct | 1 ms | 2388 KB | Output is correct |
32 | Correct | 1 ms | 2388 KB | Output is correct |
33 | Correct | 1 ms | 2556 KB | Output is correct |
34 | Correct | 1 ms | 2388 KB | Output is correct |
35 | Correct | 1 ms | 2388 KB | Output is correct |
36 | Correct | 1 ms | 2524 KB | Output is correct |
37 | Correct | 1 ms | 2400 KB | Output is correct |
38 | Correct | 1 ms | 2388 KB | Output is correct |
39 | Correct | 1 ms | 2388 KB | Output is correct |
40 | Correct | 1 ms | 2388 KB | Output is correct |
41 | Correct | 1 ms | 2388 KB | Output is correct |
42 | Correct | 1 ms | 2388 KB | Output is correct |
43 | Correct | 1 ms | 2516 KB | Output is correct |
44 | Correct | 1 ms | 2388 KB | Output is correct |
45 | Correct | 1 ms | 2388 KB | Output is correct |
46 | Correct | 1 ms | 2388 KB | Output is correct |
47 | Correct | 1 ms | 2388 KB | Output is correct |
48 | Correct | 1 ms | 2388 KB | Output is correct |
49 | Correct | 1 ms | 2388 KB | Output is correct |
50 | Correct | 2 ms | 2552 KB | Output is correct |
51 | Correct | 1 ms | 2388 KB | Output is correct |
52 | Correct | 1 ms | 2388 KB | Output is correct |
53 | Correct | 1 ms | 2388 KB | Output is correct |
54 | Correct | 1 ms | 2388 KB | Output is correct |
55 | Correct | 1 ms | 2388 KB | Output is correct |
56 | Correct | 1 ms | 2516 KB | Output is correct |
57 | Correct | 1 ms | 2552 KB | Output is correct |
58 | Correct | 1 ms | 2388 KB | Output is correct |
59 | Correct | 1 ms | 2640 KB | Output is correct |
60 | Correct | 1 ms | 2388 KB | Output is correct |
61 | Correct | 1 ms | 2388 KB | Output is correct |
62 | Correct | 1 ms | 2388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2384 KB | Output is correct |
6 | Correct | 1 ms | 2556 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2384 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2384 KB | Output is correct |
14 | Correct | 1 ms | 2384 KB | Output is correct |
15 | Correct | 1 ms | 2552 KB | Output is correct |
16 | Correct | 1 ms | 2656 KB | Output is correct |
17 | Correct | 1 ms | 2384 KB | Output is correct |
18 | Correct | 1 ms | 2384 KB | Output is correct |
19 | Correct | 1 ms | 2384 KB | Output is correct |
20 | Correct | 1 ms | 2512 KB | Output is correct |
21 | Correct | 1 ms | 2388 KB | Output is correct |
22 | Correct | 1 ms | 2552 KB | Output is correct |
23 | Correct | 2 ms | 2388 KB | Output is correct |
24 | Correct | 1 ms | 2388 KB | Output is correct |
25 | Correct | 1 ms | 2388 KB | Output is correct |
26 | Correct | 1 ms | 2388 KB | Output is correct |
27 | Correct | 1 ms | 2388 KB | Output is correct |
28 | Correct | 1 ms | 2392 KB | Output is correct |
29 | Correct | 1 ms | 2400 KB | Output is correct |
30 | Correct | 1 ms | 2552 KB | Output is correct |
31 | Correct | 1 ms | 2388 KB | Output is correct |
32 | Correct | 1 ms | 2388 KB | Output is correct |
33 | Correct | 1 ms | 2556 KB | Output is correct |
34 | Correct | 1 ms | 2388 KB | Output is correct |
35 | Correct | 1 ms | 2388 KB | Output is correct |
36 | Correct | 1 ms | 2524 KB | Output is correct |
37 | Correct | 1 ms | 2400 KB | Output is correct |
38 | Correct | 1 ms | 2388 KB | Output is correct |
39 | Correct | 1 ms | 2388 KB | Output is correct |
40 | Correct | 1 ms | 2388 KB | Output is correct |
41 | Correct | 1 ms | 2388 KB | Output is correct |
42 | Correct | 1 ms | 2388 KB | Output is correct |
43 | Correct | 1 ms | 2516 KB | Output is correct |
44 | Correct | 1 ms | 2388 KB | Output is correct |
45 | Correct | 1 ms | 2388 KB | Output is correct |
46 | Correct | 1 ms | 2388 KB | Output is correct |
47 | Correct | 1 ms | 2388 KB | Output is correct |
48 | Correct | 1 ms | 2388 KB | Output is correct |
49 | Correct | 1 ms | 2388 KB | Output is correct |
50 | Correct | 2 ms | 2552 KB | Output is correct |
51 | Correct | 1 ms | 2388 KB | Output is correct |
52 | Correct | 1 ms | 2388 KB | Output is correct |
53 | Correct | 1 ms | 2388 KB | Output is correct |
54 | Correct | 1 ms | 2388 KB | Output is correct |
55 | Correct | 1 ms | 2388 KB | Output is correct |
56 | Correct | 1 ms | 2516 KB | Output is correct |
57 | Correct | 1 ms | 2552 KB | Output is correct |
58 | Correct | 1 ms | 2388 KB | Output is correct |
59 | Correct | 1 ms | 2640 KB | Output is correct |
60 | Correct | 1 ms | 2388 KB | Output is correct |
61 | Correct | 1 ms | 2388 KB | Output is correct |
62 | Correct | 1 ms | 2388 KB | Output is correct |
63 | Correct | 642 ms | 35404 KB | Output is correct |
64 | Correct | 278 ms | 20104 KB | Output is correct |
65 | Correct | 348 ms | 34984 KB | Output is correct |
66 | Correct | 282 ms | 19808 KB | Output is correct |
67 | Correct | 288 ms | 21328 KB | Output is correct |
68 | Correct | 323 ms | 23556 KB | Output is correct |
69 | Correct | 373 ms | 35508 KB | Output is correct |
70 | Correct | 302 ms | 19788 KB | Output is correct |
71 | Correct | 296 ms | 21412 KB | Output is correct |
72 | Correct | 305 ms | 23628 KB | Output is correct |
73 | Correct | 363 ms | 35660 KB | Output is correct |
74 | Correct | 301 ms | 19976 KB | Output is correct |
75 | Correct | 301 ms | 21244 KB | Output is correct |
76 | Correct | 310 ms | 23780 KB | Output is correct |
77 | Correct | 368 ms | 35416 KB | Output is correct |
78 | Correct | 338 ms | 27652 KB | Output is correct |
79 | Correct | 327 ms | 27524 KB | Output is correct |
80 | Correct | 318 ms | 27728 KB | Output is correct |
81 | Correct | 325 ms | 27724 KB | Output is correct |
82 | Correct | 279 ms | 19788 KB | Output is correct |
83 | Correct | 134 ms | 19840 KB | Output is correct |
84 | Correct | 284 ms | 20020 KB | Output is correct |
85 | Correct | 359 ms | 36476 KB | Output is correct |
86 | Correct | 373 ms | 36428 KB | Output is correct |
87 | Correct | 325 ms | 28672 KB | Output is correct |
88 | Correct | 324 ms | 28748 KB | Output is correct |