#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |