fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int N = 1e2+10;
  5. int A[N], B[N], a, b, sa, sb;
  6. int found[N];
  7. vector<pair<int, int>> v;
  8. bool arr[N];
  9.  
  10. int main() {
  11. scanf("%d", &sa);
  12. memset(arr, 0, sizeof arr);
  13. for(int i = 0 ; i < sa ; ++i){
  14. scanf("%d", A+i);
  15. arr[A[i]] = 1;
  16. }
  17. scanf("%d", &sb);
  18. for(int i = 0 ; i < sb ; ++i){
  19. scanf("%d", B+i);
  20. arr[B[i]] = 1;
  21. }
  22.  
  23. for(int i = 0 ; i < sa ; ++i){
  24. for(int j = 0 ; j < sb ; ++j){
  25. int sum = A[i] + B[j];
  26. //int x = lower_bound(A, A+sa, )
  27. if(arr[A[i] + B[j]] == 0 ){
  28. printf("%d %d", A[i], B[j]);
  29. return 0;
  30. }
  31. }
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0s 4392KB
stdin
4
1 3 5 7
4
7 5 3 1
stdout
1 7