Submission #19577555
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; } ll 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 | 300 |
Code Size | 1236 Byte |
Status | AC |
Exec Time | 12 ms |
Memory | 3796 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 4 ms | 3648 KB |
0_001.txt | AC | 2 ms | 3564 KB |
0_002.txt | AC | 2 ms | 3632 KB |
1_003.txt | AC | 5 ms | 3700 KB |
1_004.txt | AC | 8 ms | 3780 KB |
1_005.txt | AC | 12 ms | 3672 KB |
1_006.txt | AC | 6 ms | 3712 KB |
1_007.txt | AC | 3 ms | 3708 KB |
1_008.txt | AC | 4 ms | 3680 KB |
1_009.txt | AC | 6 ms | 3704 KB |
1_010.txt | AC | 9 ms | 3780 KB |
1_011.txt | AC | 8 ms | 3740 KB |
1_012.txt | AC | 6 ms | 3628 KB |
1_013.txt | AC | 7 ms | 3728 KB |
1_014.txt | AC | 8 ms | 3768 KB |
1_015.txt | AC | 7 ms | 3640 KB |
1_016.txt | AC | 6 ms | 3740 KB |
1_017.txt | AC | 5 ms | 3624 KB |
1_018.txt | AC | 10 ms | 3692 KB |
1_019.txt | AC | 9 ms | 3736 KB |
1_020.txt | AC | 8 ms | 3796 KB |
1_021.txt | AC | 10 ms | 3700 KB |
1_022.txt | AC | 6 ms | 3772 KB |
1_023.txt | AC | 6 ms | 3620 KB |
1_024.txt | AC | 9 ms | 3736 KB |
1_025.txt | AC | 6 ms | 3764 KB |
1_026.txt | AC | 6 ms | 3780 KB |
1_027.txt | AC | 10 ms | 3696 KB |