답안 #906605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906605 2024-01-14T14:43:19 Z mickey080929 송금 (JOI19_remittance) C++17
55 / 100
1000 ms 36468 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll A[1000010];
ll B[1000010];

int main() {
	ll N;
	cin >> N;
	for (ll i=0; i<N; i++) {
		cin >> A[i] >> B[i];
	}
	for (ll loop=0; loop<100; loop++) {
		for (ll i=0; i<N; i++) {
			if (B[i] < A[i]) {
				ll t = (A[i] - B[i]) / 2;
				A[i] -= t * 2;
				A[(i+1)%N] += t;
			}
		}
	}
	bool diff = false, notone = false;
	for (ll i=0; i<N; i++) {
		if (A[i] != B[i]) {
			diff = true;
		}
		if (A[i] != 1) notone = true;
	}
	if (!diff)
		cout << "Yes\n";
	else if (!notone)
		cout << "No\n";
	else {
		for (ll i=0; i<N; i++) {
			if (A[i] - 1 != B[i]) {
				cout << "No\n";
				return 0;
			}
		}
		cout << "Yes\n";
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2496 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2400 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2648 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2492 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2496 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2400 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2648 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2492 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 1 ms 2392 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2492 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2392 KB Output is correct
47 Correct 1 ms 2392 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2392 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2392 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2396 KB Output is correct
55 Correct 1 ms 2396 KB Output is correct
56 Correct 1 ms 2396 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 1 ms 2396 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2496 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2400 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2648 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2492 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 1 ms 2392 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2492 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 1 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2392 KB Output is correct
47 Correct 1 ms 2392 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2392 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2392 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2396 KB Output is correct
55 Correct 1 ms 2396 KB Output is correct
56 Correct 1 ms 2396 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 1 ms 2396 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
63 Correct 1000 ms 35344 KB Output is correct
64 Correct 335 ms 19788 KB Output is correct
65 Correct 970 ms 35152 KB Output is correct
66 Correct 357 ms 19796 KB Output is correct
67 Correct 368 ms 21196 KB Output is correct
68 Correct 398 ms 23716 KB Output is correct
69 Correct 990 ms 35408 KB Output is correct
70 Correct 338 ms 19788 KB Output is correct
71 Correct 347 ms 21328 KB Output is correct
72 Correct 422 ms 23640 KB Output is correct
73 Correct 994 ms 35428 KB Output is correct
74 Correct 344 ms 20048 KB Output is correct
75 Correct 348 ms 21328 KB Output is correct
76 Correct 404 ms 23764 KB Output is correct
77 Correct 665 ms 35664 KB Output is correct
78 Correct 833 ms 27916 KB Output is correct
79 Correct 823 ms 27740 KB Output is correct
80 Correct 832 ms 27600 KB Output is correct
81 Correct 500 ms 27608 KB Output is correct
82 Correct 662 ms 20064 KB Output is correct
83 Correct 381 ms 19968 KB Output is correct
84 Correct 368 ms 19972 KB Output is correct
85 Execution timed out 1032 ms 36468 KB Time limit exceeded
86 Halted 0 ms 0 KB -