Submission #906603

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

using namespace std;
typedef long long ll;

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

int main() {
	ll N;
	cin >> N;
	if (N == 2) assert(0);
	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;
			}
		}
	}
	for (ll 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 2392 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -