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 arr1);
  13. for(int i = 0 ; i < sa ; ++i){
  14. scanf("%d", A+i);
  15. arr[i] = 1;
  16. }
  17. scanf("%d", &sb);
  18. for(int i = 0 ; i < sb ; ++i){
  19. scanf("%d", B+i);
  20. arr[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. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
4
1 3 5 7
4
7 5 3 1
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12:24: error: ‘arr1’ was not declared in this scope
  memset(arr, 0, sizeof arr1);
                        ^~~~
prog.cpp:12:24: note: suggested alternative: ‘arr’
  memset(arr, 0, sizeof arr1);
                        ^~~~
                        arr
prog.cpp:11:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &sa);
  ~~~~~^~~~~~~~~~~
prog.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", A+i);
   ~~~~~^~~~~~~~~~~
prog.cpp:17:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &sb);
  ~~~~~^~~~~~~~~~~
prog.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", B+i);
   ~~~~~^~~~~~~~~~~
stdout
Standard output is empty