Submission #906598

# Submission time Handle Problem Language Result Execution time Memory
906598 2024-01-14T14:36:19 Z mickey080929 Remittance (JOI19_remittance) C++17
0 / 100
1 ms 2396 KB
#include <bits/stdc++.h>

using namespace std;

int A[1000010];
int B[1000010];

int main() {
	int N;
	cin >> N;
	for (int i=0; i<N; i++) {
		cin >> A[i] >> B[i];
	}
	for (int loop=0; loop<4; loop++) {
		for (int i=0; i<N; i++) {
			if (B[i] < A[i]) {
				int t = (A[i] - B[i]) / 2;
				A[i] -= t * 2;
				A[(i+1)%N] += t;
			}
		}
	}
	for (int i=0; i<N; i++) {
		if (A[i] != B[i]) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 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 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 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 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 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 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -