# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973033 | vjudge1 | Deda (COCI17_deda) | C++17 | 1 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,q;
long long a[n+5];
cin>>n>>q;
for(int i=0;i<=n;i++){
a[i]=0;
}
vector<int> v;
string s;
long long x,b;
while(q--){
cin>>s>>x>>b;
if(s=="M"){
a[b]=x;
v.push_back(b);
}
else{
sort(v.begin(),v.end());
int flag=1;
for(int i=0;i<v.size();i++){
if(v[i]>=b){
if(a[v[i]]<=x){
cout<<v[i]<<'\n';
flag=0;
break;
}
}
}
if(flag){
cout<<"-1\n";
}
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |