knakul853

Untitled

Nov 22nd, 2020
364
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  vector<pair<int,int>>p;
  2.    
  3.     for(int i=0; i<n; i++){
  4.         p.push_back({end[i], i});
  5.     }
  6.     sort(p.begin(), p.end());
  7.    
  8.     int ans = 1;
  9.     int mx = p[0].first;
  10.    
  11.     cout<<p[0].second+1<<" ";
  12.    
  13.     for(int i=1; i<n; i++){
  14.        
  15.         if(start[p[i].second] > mx){
  16.             cout<<p[i].second+1<<" ";
  17.             mx =  p[i].first;
  18.         }
  19.        
  20.     }
RAW Paste Data