Submission #19577527


Source Code Expand

Copy
#include <bits/stdc++.h>

#include <iostream>
#include <vector>
// #include <atcoder/all>
// using namespace atcoder;

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    string no = "No", yes = "Yes";

    int N;
    cin >> N;
    vector<ll> a(N);
    vector<ll> b(N);
    ll sum_a = 0;
    ll sum_b = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum_a += a[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> b[i];
        sum_b += b[i];
    }
    if (sum_a > sum_b) {
        cout << no << endl;
        return 0;
    }

    int a_num = 0, b_num = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] > b[i]) {
            b_num += a[i] - b[i];
        } else if (a[i] < b[i]) {
            a_num += (b[i] - a[i] + 1) / 2;
            if (a[i] % 2 != b[i] % 2) {
                b_num++;
            }
        }
    }
    // cout << sum_a << " " << sum_b << endl;
    // cout << a_num << " " << b_num << endl;
    // cout << sum_b - sum_a << endl;
    // if (a_num <= sum_b - sum_a && b_num <= sum_b - sum_a)
    if (a_num + b_num == sum_b - sum_a)
        cout << yes << endl;
    else
        cout << no << endl;

    return 0;
}

Submission Info

Submission Time
Task B - Two Arrays
User nyama39
Language C++ (GCC 9.2.1)
Score 0
Code Size 1233 Byte
Status WA
Exec Time 12 ms
Memory 3764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 16
WA × 12
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt
Case Name Status Exec Time Memory
0_000.txt AC 7 ms 3632 KB
0_001.txt AC 3 ms 3480 KB
0_002.txt AC 2 ms 3564 KB
1_003.txt WA 5 ms 3728 KB
1_004.txt AC 6 ms 3616 KB
1_005.txt AC 5 ms 3608 KB
1_006.txt WA 7 ms 3684 KB
1_007.txt AC 6 ms 3728 KB
1_008.txt AC 6 ms 3704 KB
1_009.txt AC 6 ms 3560 KB
1_010.txt AC 7 ms 3736 KB
1_011.txt AC 10 ms 3736 KB
1_012.txt AC 6 ms 3736 KB
1_013.txt AC 6 ms 3732 KB
1_014.txt WA 5 ms 3684 KB
1_015.txt AC 8 ms 3668 KB
1_016.txt AC 7 ms 3700 KB
1_017.txt AC 6 ms 3608 KB
1_018.txt WA 12 ms 3764 KB
1_019.txt AC 6 ms 3620 KB
1_020.txt WA 9 ms 3668 KB
1_021.txt WA 6 ms 3608 KB
1_022.txt WA 10 ms 3760 KB
1_023.txt WA 8 ms 3616 KB
1_024.txt WA 7 ms 3704 KB
1_025.txt WA 7 ms 3684 KB
1_026.txt WA 6 ms 3620 KB
1_027.txt WA 10 ms 3680 KB