Submission #555248

# Submission time Handle Problem Language Result Execution time Memory
555248 2022-04-30T10:22:37 Z nafis_shifat Remittance (JOI19_remittance) C++17
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e6+5;
const int inf=1e9;
int a[mxn], b[mxn];
int n;
void process() {
    for(int i = 0; i < n; i++) {
        int nxt = (i + 1) % n;

        int rem = (a[i] - b[i]) / 2;
        if(rem <= 0) continue;

        a[nxt] += rem;
        a[i] -= 2 * rem;
    }
}
int main() {
    cin >> n;
    for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);

    for(int i = 0; i < 60; i++) process();

    for(int i = 0; i < n; i++) if(a[i] != b[i]) {
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:22:37: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);
      |                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -