Submission #233295

#TimeUsernameProblemLanguageResultExecution timeMemory
233295triple_faultRemittance (JOI19_remittance)C++14
0 / 100
6 ms436 KiB
/* May 20 2020 */

#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <random>

#define ll long long

using namespace std;

int main(void) {
    ll n; scanf("%lld", &n);
    ll a[n], b[n];
    for (ll i = 0; i < n; ++i) scanf("%lld%lld", &a[i], &b[i]);

    for (;;) {
        bool uhh = false;
        for (ll i = 0; i < n; ++i) {
            if (a[i] <= b[i]) continue;
            uhh = true;
            ll ts = (a[i] - b[i] + 1) / 2;
            a[(i + 1) % n] += ts; 
            a[i] -= (2 * ts);
        }

        if (!uhh) break;
    }

    for (ll i = 0; i < n; ++i) 
        if (a[i] != b[i]) {
            puts("No");
            return 0;
        }
    puts("Yes");
    return 0;
}

Compilation message (stderr)

remittance.cpp: In function 'int main()':
remittance.cpp:17:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     ll n; scanf("%lld", &n);
           ~~~~~^~~~~~~~~~~~
remittance.cpp:19:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (ll i = 0; i < n; ++i) scanf("%lld%lld", &a[i], &b[i]);
                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...