Submission #19577362
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++; } } } if (a_num <= sum_b - sum_a && 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 | 1060 Byte |
Status | WA |
Exec Time | 10 ms |
Memory | 3788 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 5 ms | 3612 KB |
0_001.txt | AC | 2 ms | 3640 KB |
0_002.txt | AC | 2 ms | 3492 KB |
1_003.txt | AC | 7 ms | 3672 KB |
1_004.txt | AC | 9 ms | 3744 KB |
1_005.txt | AC | 5 ms | 3684 KB |
1_006.txt | AC | 6 ms | 3700 KB |
1_007.txt | AC | 6 ms | 3772 KB |
1_008.txt | AC | 7 ms | 3624 KB |
1_009.txt | AC | 6 ms | 3744 KB |
1_010.txt | AC | 4 ms | 3616 KB |
1_011.txt | AC | 5 ms | 3564 KB |
1_012.txt | WA | 5 ms | 3740 KB |
1_013.txt | AC | 4 ms | 3616 KB |
1_014.txt | AC | 5 ms | 3696 KB |
1_015.txt | WA | 8 ms | 3728 KB |
1_016.txt | WA | 5 ms | 3788 KB |
1_017.txt | AC | 5 ms | 3780 KB |
1_018.txt | AC | 5 ms | 3696 KB |
1_019.txt | AC | 5 ms | 3620 KB |
1_020.txt | AC | 7 ms | 3676 KB |
1_021.txt | AC | 10 ms | 3728 KB |
1_022.txt | AC | 6 ms | 3752 KB |
1_023.txt | AC | 8 ms | 3672 KB |
1_024.txt | AC | 8 ms | 3740 KB |
1_025.txt | AC | 8 ms | 3748 KB |
1_026.txt | AC | 6 ms | 3624 KB |
1_027.txt | AC | 6 ms | 3616 KB |