Guest User

Untitled

a guest
Jul 24th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. #include <assert.h>
  6. #include <algorithm>
  7. using namespace std;
  8.  
  9.  
  10. typedef struct  {
  11.     int index;
  12.     int a;
  13.     int b;
  14. } test;
  15.  
  16. bool cmp( test a, test b) {
  17.     if(a.a==b.a) {
  18.         return a.b<b.b;
  19.     }
  20.     return a.a<b.b;
  21. }
  22.  
  23. int main() {
  24.     int t;
  25.     vector<test> arr;
  26.     int n;
  27.     cin>>n;
  28.     for(int i=0;i<n;i++) {
  29.         test tmp;
  30.         cin>>tmp.index>>tmp.a>>tmp.b;
  31.         arr.push_back(tmp);
  32.     }
  33.     sort(arr.begin(),arr.end(),cmp);
Add Comment
Please, Sign In to add comment