Advertisement
STANAANDREY

CF 3pb

Oct 5th, 2019
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define uns unsigned
  3. #define ll long long
  4. #define newline '\n'
  5. using namespace std;
  6. ///**************************contest setup
  7.  
  8. const uns NMAX(3005);
  9. set <int> s;
  10. int v[NMAX];
  11.  
  12. int main()
  13. {
  14.     int n, nr(3);
  15.     cin >> n;
  16.     for (int i = 1; i <= n; i++)
  17.     {
  18.         cin >> v[i];
  19.         s.insert(v[i]);
  20.     }
  21.  
  22.     if ((int)s.size() < nr)
  23.     {
  24.         while (nr--)
  25.             cout << -1 << ' ';
  26.     }
  27.     else
  28.     {
  29.         for (auto it = s.begin(); it != s.end() && nr--; it++)
  30.         {
  31.             int x = *it;
  32.             for (int i = 1; i <= n; i++)
  33.                 if (x == v[i])
  34.                 {
  35.                     cout << i << ' ';
  36.                     break;
  37.                 }
  38.         }
  39.     }
  40.     return EXIT_SUCCESS;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement