fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n, k;
  7. cin >> n >> k;
  8.  
  9. int a[100005];
  10.  
  11. for (int i = 0; i < n; i++)
  12. cin >> a[i];
  13.  
  14. bool found = false;
  15.  
  16. for (int i = 0; i < n - 1; i++) {
  17. for (int j = i + 1; j < n; j++) {
  18. if (a[i] + a[j] == 2 * k) {
  19. cout << i << " " << j << endl;
  20. found = true;
  21. }
  22. }
  23. }
  24.  
  25. if (!found)
  26. cout << "NO";
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
NO