Submission #74565062


Source Code Expand

#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, n) for(int  i = 0; i < (n); ++i)
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;
int gcd(int a, int b){
    if(b == 0) return a;  
    else return gcd(b, a%b);
}
struct Compare {
    bool operator()(const pair<ll, int>& a, const pair<ll, int>& b) {
        return a.first > b.first;  
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int q; cin >> q;
    priority_queue<int, vector<int>, greater<int>> pq;
    while(q--){
        int t; cin >> t;
        if(t == 1){
            int h; cin >> h;
            pq.push(h);
        }else{
            int h; cin >> h;
            while(!pq.empty() && pq.top() <= h){
                pq.pop();
            }
        }
        cout << pq.size() << endl;
    }
}

Submission Info

Submission Time
Task C - Understory
User motomoto0001
Language C++23 (GCC 15.2.0)
Score 300
Code Size 1079 Byte
Status AC
Exec Time 141 ms
Memory 5588 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 13
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 3520 KiB
00_sample_01.txt AC 1 ms 3604 KiB
01_random_00.txt AC 126 ms 3704 KiB
01_random_01.txt AC 129 ms 3672 KiB
01_random_02.txt AC 134 ms 3512 KiB
01_random_03.txt AC 135 ms 3636 KiB
01_random_04.txt AC 135 ms 5588 KiB
01_random_05.txt AC 140 ms 3908 KiB
01_random_06.txt AC 137 ms 3892 KiB
01_random_07.txt AC 141 ms 4776 KiB
01_random_08.txt AC 130 ms 4572 KiB
01_random_09.txt AC 139 ms 4568 KiB
01_random_10.txt AC 134 ms 3592 KiB