forked from tanmayhinge-zz/competitive-programming-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTOTCRT.cpp
39 lines (33 loc) · 737 Bytes
/
TOTCRT.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n = 0;
cin>>n;
n*=3;
map <string, int> m;
while(n--){
string s;
cin>>s;
int c;
cin>>c;
m[s] +=c;
}
// for(auto i : m)
// cout<<i.second<<" ";
vector<int> v;
for (auto i: m){
//cout<< "inserted: "<<i.second<<" ";
v.push_back(i.second);
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++){
cout << v[i] << " ";
}
cout << endl;
}
return 0;
}