Submission #472808

#TimeUsernameProblemLanguageResultExecution timeMemory
472808Mr_OK_ManDeda (COCI17_deda)C++17
60 / 140
1089 ms12612 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
  //  cout << "Hello world!" << endl;
  long long n,q;
  cin>>n>>q;
  map<long long,long long>mp;
  while(q--)
  {
      char w;
      cin>>w;
      if(w=='M')
      {
          long long x,a;
          cin>>x>>a;
          mp[a]=x;
      }
      else
      {
          long long y,b;
          cin>>y>>b;
          long long f=-1;
          for(int i=b;i<=n;i++)
          {
              if(mp[i]<=y&&mp[i]!=0)
              {
              f=i;
              break;
              }
          }
          cout<<f<<endl;

      }
  }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...