SHARE
TWEET

Untitled

a guest Nov 7th, 2018 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using namespace std;
  2. int main()
  3. {
  4.     int n; cin >> n;
  5.     vector<int> soldiers;
  6.     for(int i=0; i<n; i++)
  7.     {
  8.         int cmd,param;
  9.         cin >> cmd >> param;
  10.         if(cmd == 1)
  11.         {
  12.             vector<int>::iterator pos = upper_bound(soldiers.begin(), soldiers.end(), -param);
  13.             pos = soldiers.insert(pos, -param);
  14.             cout << pos - soldiers.begin() << endl;
  15.         }
  16.         else
  17.         {
  18.             soldiers.erase(soldiers.begin()+param);
  19.         }
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top