Submission #187333

# Submission time Handle Problem Language Result Execution time Memory
187333 2020-01-12T18:15:26 Z wet_water Remittance (JOI19_remittance) C++14
0 / 100
6 ms 376 KB
#include <iostream>
#include <fstream>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <map>
#include <string.h>
#include <math.h>
#include <set>

#define MAX_N 1000005
#define f first
#define s second

using namespace std;

typedef pair<int, int> ii;

int A[MAX_N], B[MAX_N];
int N;

void solve() {
    cin >> N;
    
    for (int i = 0; i < N; i ++) {
        cin >> A[i] >> B[i];
    }
    
    int carry;
    for (int ii = 0; ii < 100; ii ++) {
        for (int i = 0; i < N; i ++) {
            if (A[i] > B[i]) {
                carry = ((A[i] - B[i]) / 2);
                A[i] -= ((A[i] - B[i]) / 2) * 2;
                A[(i + 1) % N] += carry;
            }
        }
    }
    
    bool flag = true;
    for (int i = 0; i < N; i ++) {
        flag = (flag && (A[i] == B[i]));
    }
    
    if (flag)
        cout << ("Yes") << endl;
    else {
        cout << "No" << endl;
    }
    
    return;
}
 
int main() {
    int T;
    T = 1;
    
    for (int i = 0; i < T; i ++) {
        solve();
    }
 
    return (0);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 6 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 6 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 6 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -