Advertisement
Ahmed_Negm

b

May 26th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cmath>
  4. #include<iomanip>
  5. #include<algorithm>
  6. #include<cstdlib>
  7. #include<cstring>
  8. #include<vector>
  9. #include<utility>
  10. using namespace std;
  11.  
  12. #define ll long long
  13. #define nl '\n'
  14. #define sz(x) int(x.size())
  15. #define all(x) x.begin(),x.end()
  16. #define rall(s)  s.rbegin(), s.rend()
  17. #define getline(s) getline(cin>>ws,s)
  18. #define ceill(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
  19. #define pi  3.141592653589793
  20.  
  21. /*
  22. ███╗░░██╗███████╗░██████╗░███╗░░░███╗
  23. ████╗░██║██╔════╝██╔════╝░████╗░████║
  24. ██╔██╗██║█████╗░░██║░░██╗░██╔████╔██║
  25. ██║╚████║██╔══╝░░██║░░╚██╗██║╚██╔╝██║
  26. ██║░╚███║███████╗╚██████╔╝██║░╚═╝░██║
  27. ╚═╝░░╚══╝╚══════╝░╚═════╝░╚═╝░░░░░╚═╝
  28.  
  29. */
  30.  
  31. void Fast_IO(){
  32. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  33. freopen("files.in", "r", stdin);
  34. // #ifndef ONLINE_JUDGE
  35. // freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  36. // #endif
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43. void solve(){
  44.   ll n,id; cin>>n;
  45.   string s;
  46.   map<string,set<ll>>mp;
  47.   while(n--){
  48.     cin>>s>>id;
  49.     mp[s].emplace(id);
  50.   }
  51.   for(auto &x:mp){
  52.     cout<<*x.second.begin()<<' ';
  53.   }
  54. cout<<nl;
  55.  
  56.  
  57.  
  58. }
  59.  
  60. int main(){
  61.     Fast_IO();
  62. int t =1;
  63. cin>>t;
  64. while(t--){
  65. solve();
  66. }
  67. return 0;
  68. }  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement