-
Notifications
You must be signed in to change notification settings - Fork 2
/
00482.cpp
38 lines (36 loc) · 684 Bytes
/
00482.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
#include<iostream>
#include<vector>
#include<algorithm>
#include<sstream>
#include<string>
using namespace std;
int main()
{
int t;
cin >> t;
cin.ignore(100, '\n');
for(int i = 0; i < t; i++)
{
cin.ignore(100, '\n');
if(i > 0)
cout << endl;
string input;
stringstream ss;
stringstream sss;
vector< pair<int, string> > nums;
getline(cin, input);
ss.str(input);
getline(cin, input);
sss.str(input);
int n;
string d;
while(ss >> n)
{
sss >> d;
nums.push_back(make_pair(n, d));
}
sort(nums.begin(), nums.end());
for(vector< pair<int, string> >::iterator i = nums.begin(); i != nums.end(); i++)
cout << i->second << endl;
}
}