답안 #472808

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472808 2021-09-14T11:09:11 Z Mr_OK_Man Deda (COCI17_deda) C++17
60 / 140
1000 ms 12612 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 32 ms 356 KB Output is correct
4 Execution timed out 1080 ms 12244 KB Time limit exceeded
5 Execution timed out 1089 ms 6488 KB Time limit exceeded
6 Execution timed out 1046 ms 9540 KB Time limit exceeded
7 Execution timed out 1087 ms 12612 KB Time limit exceeded