# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
954250 | vjudge1 | Deda (COCI17_deda) | C++17 | 1065 ms | 1464 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |