hiho week 153 register

Ended

Participants:259

Verdict:Accepted
Score:100 / 100
Submitted:2017-06-09 18:51:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "iostream"
#include "set"
#include "map"
using namespace std;
int n; map<int, int>s;multiset<int>ss;
#define b .begin()
#define rb .rbegin()
#define t ->first
#define z ->second
#define k break;
void P(int x, int y) {s[x] = y;ss.insert(y);}
void Q() {cout << *(ss rb) << " " << *(ss b) << " " << s rb z<< endl;}
void R(int r) {while(s.size()!=0&&s b t <=r) {auto itr = ss.find(s b z);ss.erase(itr);s.erase(s b);}}
int main()
{cin >> n;while (n--) {char p;cin >> p;switch (p) {case 'P':int x, y;cin >> x >> y;P(x, y);k case 'Q':Q();k;default:int r;cin >> r;R(r);k}}return 0;}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX