Submission #787445

# Submission time Handle Problem Language Result Execution time Memory
787445 2023-07-19T08:00:48 Z anton Remittance (JOI19_remittance) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long

const int MAX_N = 1e6;
int n,a[MAX_N], b[MAX_N];
signed main(){
    cin>>n;

    for(int i = 0; i<n; i++){
        cin>>a[i];
        cin>>b[i];
    }

    for(int turn = 0; turn<35; turn++){
        for(int i = 0; i<n; i++){
            int dif= (a[i]-b[i])/2;
            if(dif>0){
                a[i]-=2*dif;
                a[(i+1)%n] += dif;
            }
        }
    }

    bool ok = true;

    for(int i = 0; i<n; i++){
        ok &= a[i]==b[i];
    }

    if(ok){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -