Submission #74549484
Source Code Expand
#include <iostream>
#include <vector>
#include <algorithm>
#include<deque>
#include<cstring>
#include<map>
#include<set>
#include<cctype>
#include<iomanip>
#include<cmath>
#include<queue>
#include<climits>
#include<numeric>
#include<unordered_set>
#include<stack>
using namespace std;
#define DEBUG(x) cerr<< #x <<' = '<< x <<endl
#define ll long long
#define all(a) a.begin(),a.end()
#define pb push_back
#define pll pair<ll,ll>
#define unset unordered_set
ll gcd(ll a, ll b) {
if (b == 0)return a;
return gcd(b, a % b);
}
void solve() {
int q;
cin >> q;
priority_queue<int,vector<int>,greater<int>>qu;
while (q--) {
int op, h;
cin >> op >> h;
if (op == 1)qu.push(h);
else {
while (!qu.empty() and qu.top() <= h)qu.pop();
}
if (qu.empty())cout << "0\n";
else cout << qu.size() << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T = 1;
//cin >> T;
while (T--)
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Understory |
| User | fqycal |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 1084 Byte |
| Status | AC |
| Exec Time | 149 ms |
| Memory | 5440 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3504 KiB |
| 00_sample_01.txt | AC | 1 ms | 3476 KiB |
| 01_random_00.txt | AC | 23 ms | 3400 KiB |
| 01_random_01.txt | AC | 133 ms | 3588 KiB |
| 01_random_02.txt | AC | 141 ms | 3564 KiB |
| 01_random_03.txt | AC | 144 ms | 3412 KiB |
| 01_random_04.txt | AC | 142 ms | 5440 KiB |
| 01_random_05.txt | AC | 147 ms | 3808 KiB |
| 01_random_06.txt | AC | 142 ms | 3836 KiB |
| 01_random_07.txt | AC | 149 ms | 4416 KiB |
| 01_random_08.txt | AC | 137 ms | 4444 KiB |
| 01_random_09.txt | AC | 148 ms | 4472 KiB |
| 01_random_10.txt | AC | 135 ms | 3476 KiB |