Submission #472862

# Submission time Handle Problem Language Result Execution time Memory
472862 2021-09-14T12:19:24 Z Ahmed57 Deda (COCI17_deda) C++14
40 / 140
1000 ms 1296 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;
    cin>>n>>m;
    set<pair<long long,long long>> v;
    for(int i = 0;i<m;i++){
        char x;long long a,b;
        cin>>x>>a>>b;
        if(x=='M'){
            v.insert({a,b});
        }else{
            long long ans = 1e18;
            auto it = v.lower_bound({b,a});if(it!=v.begin())it--;
            for(;it!=v.end();it++){
                if((*it).second>=b&&(*it).first<=a){
                    ans = min(ans,(*it).second);
                }
            }
            if(ans==1e18){
                cout<<-1<<"\n";
            }else cout<<ans<<"\n";
        }
    }
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 25 ms 376 KB Output isn't correct
4 Correct 411 ms 1296 KB Output is correct
5 Execution timed out 1090 ms 860 KB Time limit exceeded
6 Execution timed out 1056 ms 952 KB Time limit exceeded
7 Execution timed out 1082 ms 788 KB Time limit exceeded