# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
868707 | Victor_9 | Deda (COCI17_deda) | C++14 | 1073 ms | 4724 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//x
#include <bits/stdc++.h>
using namespace std;
const int NMax=2e5+5;
//ifstream fin("x.in");
int n, q, i, j, s, c, l, poz, ok;
char nume;
vector<pair<int, int>>v;
// bool compare(int a, int b){
// if(a.first>b.first){
// return 1;
// }
// return 0;
// }
struct compare {
bool operator()(const pair<int, int>& value,
const int& key)
{
return (value.first < key);
}
bool operator()(const int& key,
const pair<int, int>& value)
{
return (key < value.first);
}
};
int main()
{
cin>>n>>q;
for(i=1;i<=q;i++){
cin>>nume>>s>>c;
ok=0;
if(nume=='M'){
v.push_back({c,s});
sort(v.begin() , v.end());
l++;
}
if(nume=='D'){
poz=lower_bound(v.begin(), v.end(), c, compare())-v.begin();
//cout<<poz<<" ";
for(j=poz;j<l;j++){
if(v[j].second<=s){
cout<<v[j].first<<endl;
ok=1;
break;
}
}
if(ok==0){
cout<<-1<<endl;
}
}
}
// for(i=0;i<l;i++){
// cout<<v[i].first<<" ";
// }
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |