#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 |