# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
469907 | Karabasan | Deda (COCI17_deda) | C++17 | 6 ms | 716 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n,q;
char a;
int b,c;
multiset<pair<int,int> > s;
map<pair<int,int>,int > mp;
int par(pair<int,int> k,pair<int,int> z)
{
return ((k.first<z.first)||(k.second<z.second));
}
int bul(pair<int,int> &p)
{
auto up=lower_bound(s.begin(),s.end(),p,par);
if(up==s.end())
{
cout<<"-1"<<endl;
return 0;
}
cout<<(*up).first<<endl;
}
int main()
{
scanf("%d%d",&n,&q);
while(q--)
{
cin>>a>>b>>c;
if(mp[{c,b}]==1)
{
printf("%d\n",c);
continue;
}
mp[{c,b}]=1;
if(a=='M')
{
s.insert({c,-b});
}
else
{
pair<int,int> pa={c,-b};
bul(pa);
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |