답안 #472831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472831 2021-09-14T11:36:28 Z Ahmed_Solyman Deda (COCI17_deda) C++14
60 / 140
1000 ms 25020 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 38 ms 480 KB Output is correct
4 Execution timed out 1082 ms 24468 KB Time limit exceeded
5 Execution timed out 1075 ms 12688 KB Time limit exceeded
6 Execution timed out 1090 ms 18856 KB Time limit exceeded
7 Execution timed out 1094 ms 25020 KB Time limit exceeded