C++
x
30
1
2
3
using namespace std;4
int main()5
{6
ios_base::sync_with_stdio(false);7
cin.tie();8
cout.tie();9
10
freopen("input.txt","r",stdin);11
freopen("output.txt","w",stdout);12
13
int TestCase;14
cin>>TestCase;15
while(TestCase--){16
int HardDisk,Total;17
vector<pair<int,int>>Data;18
cin>>Total>>HardDisk;19
while(Total--){20
int IMDB,Size;21
cin>>Size>>IMDB;22
Data.push_back(make_pair(Size,IMDB));23
}24
sort(Data.begin(),Data.end());25
for(int i=0;i<Data.size();i++){26
cout<<Data[i].first<<" "<<Data[i].second<<endl;27
}28
}29
}30
$ g++ prog.cc -Wall -Wextra -std=c++2a -pedantic "-DONLINE_JUDGE"
Stdin
15 110 2030 1020 401 614555 111Start
prog.cc: In function 'int main()':
prog.cc:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<Data.size();i++){
| ~^~~~~~~~~~~~
1 614 10 20 20 40 30 10 555 111
0
Finish