# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472887 |
2021-09-14T12:50:14 Z |
Ahmed57 |
Deda (COCI17_deda) |
C++14 |
|
1000 ms |
1512 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,g=0;
cin>>n>>m;
vector<pair<long long,long long>> v;
set<pair<int,int>> s;
for(int i = 0;i<m;i++){
char x;long long a,b;
cin>>x>>a>>b;
if(x=='M'){
v.push_back({a,b});
s.insert({a,g});
g++;
}else{
long long ans = 1e18;
set<pair<int,int>>::iterator it = s.begin();
for(;it!=s.end();it++){
if((*it).first>a)break;
if(v[(*it).second].second>=b)ans = min(ans,v[(*it).second].second);
}
if(ans==1e18){
cout<<-1<<"\n";
}else cout<<ans<<"\n";
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
372 KB |
Output is correct |
4 |
Correct |
140 ms |
1348 KB |
Output is correct |
5 |
Execution timed out |
1081 ms |
1512 KB |
Time limit exceeded |
6 |
Execution timed out |
1082 ms |
1336 KB |
Time limit exceeded |
7 |
Execution timed out |
1075 ms |
1400 KB |
Time limit exceeded |