Submission #958776

# Submission time Handle Problem Language Result Execution time Memory
958776 2024-04-06T15:14:45 Z raphaelp Remittance (JOI19_remittance) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
long long main()
{
    long long N;
    cin >> N;
    vector<long long> A(N), B(N);
    for (long long i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
    }
    for (long long i = 0; i < N - 1; i++)
    {
        if (A[i] > B[i])
        {
            long long amount = A[i] - B[i] - ((A[i] - B[i]) % 2);
            A[i] -= amount;
            A[i + 1] += amount / 2;
        }
    }
    long long buff = N - 1;
    while (A[buff] > B[buff] + 1)
    {
        if (A[buff] > B[buff])
        {
            long long amount = A[buff] - B[buff] - ((A[buff] - B[buff]) % 2);
            A[buff] -= amount;
            A[(buff + 1) % N] += amount / 2;
        }
        buff = (buff + 1) % N;
    }
    long long done = 1;
    for (long long i = 0; i < N; i++)
        if (A[i] != B[i])
            done = 0;
    if (done)
        cout << "Yes";
    else
        cout << "No";
}

Compilation message

cc1plus: error: '::main' must return 'int'