Advertisement
Guest User

CDVR3.2

a guest
Oct 28th, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | Source Code | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int mxn = 2e5;
  4.                                     //#define Kin
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio(0);
  9.     cin.tie(0);
  10.  
  11. #ifdef Kin
  12.     (void)!freopen("input.txt", "r", stdin);
  13.     (void)!freopen("output.txt", "w", stdout);
  14. #endif
  15.  
  16.     int t;
  17.     cin >> t;
  18.     while (t--)
  19.     {
  20.         int n;
  21.         cin >> n;
  22.         map<float, set<int>> mp;
  23.         for (int i = 0; i < n; i++)
  24.         {
  25.             float k;
  26.             cin >> k;
  27.             mp[k].insert(i + 1);
  28.         }
  29.         int pos = 0;
  30.         auto itm = mp.begin();
  31.         cout << "Winning Registration Numbers are: ";
  32.         while (itm != mp.end() && pos < 3)
  33.         {
  34.             for (auto its = itm->second.begin(); its != itm->second.end(); its++)
  35.                 cout << *its << " ";
  36.             itm++;
  37.             pos++;
  38.         }
  39.         cout << '\n';
  40.     }
  41.     return 0;
  42. }
Tags: CDVR3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement