O_Egor

var 2

Jun 2nd, 2023 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.     map<int, int> mp;
  11.     for(int i = 0; i < n; ++i)
  12.     {
  13.         int a;
  14.         cin >> a;
  15.         if(mp.count(a) == 1)
  16.         {
  17.             cout << mp[a] << ' ' << i + 1 << '\n';
  18.             return 0;
  19.         }
  20.         mp[a] = i + 1;
  21.  
  22.     }
  23.     cout << "NO\n";
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment