# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
469909 |
2021-09-02T09:23:56 Z |
Karabasan |
Deda (COCI17_deda) |
C++17 |
|
6 ms |
692 KB |
#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;
}
Compilation message
deda.cpp: In function 'long long int bul(std::pair<long long int, long long int>&)':
deda.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
deda.cpp: In function 'int main()':
deda.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
28 | scanf("%lld%lld",&n,&q);
| ~~~~~^~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
2 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
3 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
4 |
Runtime error |
6 ms |
692 KB |
Execution killed with signal 6 |
5 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
6 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |
7 |
Runtime error |
3 ms |
460 KB |
Execution killed with signal 6 |