Submission #472831

#TimeUsernameProblemLanguageResultExecution timeMemory
472831Ahmed_SolymanDeda (COCI17_deda)C++14
60 / 140
1094 ms25020 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,q;cin>>n>>q; map<ll,bool>vis; map<ll,ll>mp; while(q--){ char c;cin>>c; if(c=='M'){ ll x,a;cin>>x>>a; mp[a]=x; vis[a]=1; } else{ ll y,b;cin>>y>>b; ll ans=-1; for(ll i=b;i<=n;i++){ if(mp[i]<=y && vis[i]){ ans=i; break; } } cout<<ans<<endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...