Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, b;
- cin >> n;
- int* arra = new int[n];
- for (int i = 0; i < n; i++) {
- cin >> arra[i];
- }
- cin >> b;
- int* arrb = new int[b];
- for (int i = 0; i < b; i++) {
- cin >> arrb[i];
- }
- int j = 0;
- for (int i = 0; i < n; j++) {
- if (arra[i] + arrb[j] == 10000) {
- cout << "YES";
- return 0;
- }
- if (j == b - 1) {
- i++;
- j = 0;
- }
- }
- cout << "NO";
- delete[] arra;
- delete[] arrb;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement