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