답안 #233291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
233291 2020-05-20T08:46:08 Z triple_fault 송금 (JOI19_remittance) C++14
0 / 100
5 ms 384 KB
/* 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);
            a[i] = max(a[i], 0LL);
        }

        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

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]);
                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -