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(arr1, 0, sizeof arr1);
  13. memset(arr2, 0, sizeof arr2);
  14. for(int i = 0 ; i < sa ; ++i){
  15. scanf("%d", A+i);
  16. arr[i] = 1;
  17. }
  18. scanf("%d", &sb);
  19. for(int i = 0 ; i < sb ; ++i){
  20. scanf("%d", B+i);
  21. arr[i] = 1;
  22. }
  23.  
  24. for(int i = 0 ; i < sa ; ++i){
  25. for(int j = 0 ; j < sb ; ++j){
  26. int sum = A[i] + B[j];
  27. //int x = lower_bound(A, A+sa, )
  28. if(arr[A[i] + B[j]] == 0 ){
  29. printf("%d %d", A[i], B[j]);
  30. return 0;
  31. }
  32. }
  33. }
  34. return 0;
  35. }
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:9: error: ‘arr1’ was not declared in this scope
  memset(arr1, 0, sizeof arr1);
         ^~~~
prog.cpp:12:9: note: suggested alternative: ‘arr’
  memset(arr1, 0, sizeof arr1);
         ^~~~
         arr
prog.cpp:13:9: error: ‘arr2’ was not declared in this scope
  memset(arr2, 0, sizeof arr2);
         ^~~~
prog.cpp:13:9: note: suggested alternative: ‘arr’
  memset(arr2, 0, sizeof arr2);
         ^~~~
         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:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", A+i);
   ~~~~~^~~~~~~~~~~
prog.cpp:18:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &sb);
  ~~~~~^~~~~~~~~~~
prog.cpp:20: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