Submission #402936

# Submission time Handle Problem Language Result Execution time Memory
402936 2021-05-12T14:42:37 Z wildturtle Remittance (JOI19_remittance) C++14
0 / 100
1 ms 300 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define sc second
#define pb push_back
using namespace std;
ll a,b,c,d,i,e,f,g,n,m,k,l;
pair <ll,ll> A[1000006];
int main() {
    cin>>n;
    for(ll i=1;i<=n;i++) {
        cin>>A[i].f>>A[i].sc;
    }
    while(true) {
        b=0;
        for(ll i=1;i<=n;i++) {
            if(A[i].f<=A[i].sc) continue;
            a=A[i].f-A[i].sc;
            if(i==n) A[1].f+=a/2;
            else A[i+1].f+=a/2;
            if(a/2>0) b=1;
            A[i].f=A[i].sc+a%2;
        }
        if(b==0) break;
    }
    a=0;
    for(ll i=1;i<=n;i++) {
        if(A[i].f!=A[i].sc) a=1;
    }
    if(a==1) cout<<"No";
    else cout<<"Yes";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -