답안 #233295

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
233295 2020-05-20T08:47:02 Z triple_fault 송금 (JOI19_remittance) C++14
0 / 100
6 ms 436 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);
        }

        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 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 288 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 308 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Incorrect 5 ms 436 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 288 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 308 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Incorrect 5 ms 436 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 288 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 308 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Incorrect 5 ms 436 KB Output isn't correct
21 Halted 0 ms 0 KB -