Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- #define pb push_back
- #define ss second
- int main()
- {
- _test
- {
- int n;
- cin>>n;
- vector<int> a(n);
- for(auto &e: a)
- cin>>e;
- vector<pair<int, int>> vp;
- for(int i=0; i<n; i++)
- vp.pb({a[i], i});
- sort(vp.begin(), vp.end());
- vector<int> ans(n);
- for(int i=0; i<n; i++)
- ans[vp[i].ss] = n-i;
- for(auto e: ans)
- cout<<e<<" ";
- cout<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment