SHOW:
|
|
- or go back to the newest paste.
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; |
22 | + | vector<long long> res(n, -1); |
23 | stack<pair<int, long long>> s; | |
24 | for (int i = 0; i < n; i++) | |
25 | - | float k; |
25 | + | |
26 | long long k; | |
27 | - | mp[k].insert(i + 1); |
27 | + | |
28 | while (!s.empty() && s.top().second < k) | |
29 | - | int pos = 0; |
29 | + | { |
30 | - | auto itm = mp.begin(); |
30 | + | res[s.top().first] = k; |
31 | - | cout << "Winning Registration Numbers are: "; |
31 | + | s.pop(); |
32 | - | while (itm != mp.end() && pos < 3) |
32 | + | } |
33 | s.push(make_pair(i, k)); | |
34 | - | for (auto its = itm->second.begin(); its != itm->second.end(); its++) |
34 | + | |
35 | - | cout << *its << " "; |
35 | + | for (long long i = 0; i < n; i++) |
36 | - | itm++; |
36 | + | cout << res[i] << ' '; |
37 | - | pos++; |
37 | + | |
38 | } | |
39 | return 0; | |
40 | } |