# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954250 | vjudge1 | Deda (COCI17_deda) | C++17 | 1065 ms | 1464 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/extc++.h>
#include <bits/stdc++.h>
#define pii pair<int,int>
using namespace __gnu_pbds;
using namespace std;
tree <pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> s;
int main(){
int n, q, m = 0;
cin >> n >> q;
//no gets off see as inf
//
while(q){
char op;
int a, b;
cin >> op >> a >> b;
if(op == 'M'){
//a=x,b=studentA
s.insert({b,a});
m++;
}
if(op == 'D'){
//a=Y,b=B >=Bstu,smallest station stu
//小於等於Y站的ID(b)y最小的->order(k)if *it.second <= b;
int k = 0;
while(k < m){
auto it = s.find_by_order(k);
if( it->second <= a && it->first >= b){
cout << it->first << endl;//<< " " << it->second << "("<< a << "," << b << ")" << endl;
break;
}
k++;
}
if(k == m) cout << -1 << endl;
}
q--;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |