# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136084 | dnass | Remittance (JOI19_remittance) | C++14 | 2 ms | 380 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;
typedef long long int lld;
lld n;
lld a[21];
int main(){
scanf("%lld", &n);
for(lld i=0;i<n;i++){
lld tmpa, tmpb; scanf("%lld %lld", &tmpa, &tmpb);
a[i] = tmpa-tmpb;
}
lld sum = 0;
lld pow_two = 1;
for(lld i=0;i<n;i++){
sum += pow_two*a[i];
pow_two *= 2;
}
if(sum%(pow_two-1)!=0){
printf("No\n");
return 0;
}
sum /= (pow_two-1);
for(lld i=n-1;i>=0;i--){
sum *= 2; sum -= a[i];
if(sum<0){
printf("No\n");
return 0;
}
}
printf("Yes\n");
return 0;
}
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... |