# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778917 | shoryu386 | Remittance (JOI19_remittance) | C++17 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
int n; cin >> n;
int a[n], b[n]; for (int x = 0;x < n; x++) cin >> a[x] >> b[x];
#define SUS 40000
for (int y = 0; y < SUS; y++){
for (int x = 0; x < n; x++){
if (a[x] >= b[x] + 2){
int trans = (a[x] - b[x])/2;
a[x] -= 2*trans;
if (x != n-1) a[x+1] += trans;
else a[0] += trans;
}
}
}
bool wtf = true;
for (int x = 0; x < n; x++){
//if (a[x] >= b[x] + 2) assert(false);
if (a[x] != b[x]) wtf = false;
}
if (wtf) cout << "Yes";
else {
if (n % 2 == 0){
bool bruh = true;
for (int x = 0; x < n; x++) if (a[x] != b[x]+1) bruh = false;
if (bruh) { cout << "Yes"; return 0;}
//assert(false);
}
cout << "No";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |