Submission #24652562
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;#define int long long#define pb push_back#define fi first#define si second#define ar array#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)typedef pair<int,int> pi;template <typename Arg>void __f(string name, Arg arg) {cerr << name << " = " << arg << endl;}template <typename Head, typename... Tail>void __f(string names, Head head, Tail... tail) {string cur = "";for (auto ch: names){if(ch==','){break;}else{cur+=ch;}}string nxt = names.substr(cur.size()+2);cerr << cur << " = " << head << ", ";__f(nxt, tail...);}
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define fi first #define si second #define ar array #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) typedef pair<int,int> pi; template <typename Arg> void __f(string name, Arg arg) { cerr << name << " = " << arg << endl; } template <typename Head, typename... Tail> void __f(string names, Head head, Tail... tail) { string cur = ""; for (auto ch: names){if(ch==','){break;}else{cur+=ch;}} string nxt = names.substr(cur.size()+2); cerr << cur << " = " << head << ", "; __f(nxt, tail...); } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int Q; cin >> Q; priority_queue<int, vector<int>, greater<int> > pq; int add = 0; while (Q--) { int op; cin >> op; if (op == 1) { int x; cin >> x; pq.push(x); } else if (op == 2) { int x; cin >> x; add += x; } else { cout << pq.top() + add << '\n'; pq.pop(); } if (op != 2) add = 0; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Querying Multiset |
User | deadeye888 |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 1024 Byte |
Status | WA |
Exec Time | 43 ms |
Memory | 5260 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt |
All | example_00.txt, example_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, small_00.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt, small_05.txt, special_00.txt, special_01.txt, special_02.txt, special_03.txt, special_04.txt, special_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 5 ms | 3496 KB |
example_01.txt | AC | 2 ms | 3612 KB |
random_00.txt | WA | 43 ms | 4088 KB |
random_01.txt | WA | 41 ms | 3816 KB |
random_02.txt | WA | 41 ms | 3776 KB |
random_03.txt | WA | 41 ms | 4148 KB |
random_04.txt | WA | 43 ms | 3792 KB |
random_05.txt | WA | 41 ms | 3792 KB |
random_06.txt | WA | 39 ms | 4092 KB |
random_07.txt | WA | 42 ms | 3808 KB |
random_08.txt | WA | 43 ms | 3724 KB |
random_09.txt | WA | 39 ms | 4252 KB |
random_10.txt | WA | 41 ms | 3860 KB |
random_11.txt | WA | 40 ms | 3720 KB |
small_00.txt | WA | 42 ms | 4256 KB |
small_01.txt | WA | 39 ms | 3776 KB |
small_02.txt | WA | 41 ms | 3780 KB |
small_03.txt | WA | 41 ms | 4236 KB |
small_04.txt | WA | 40 ms | 3696 KB |
small_05.txt | WA | 41 ms | 3888 KB |
special_00.txt | AC | 32 ms | 3600 KB |
special_01.txt | AC | 39 ms | 5260 KB |
special_02.txt | AC | 36 ms | 5228 KB |
special_03.txt | AC | 32 ms | 3576 KB |
special_04.txt | AC | 36 ms | 3620 KB |
special_05.txt | AC | 35 ms | 3520 KB |