提出 #74521856


ソースコード 拡げる

#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<cmath>
#include<stack>
#include<set>
#include<climits>
#include<map>
#include<queue>
#include<deque>
using namespace std;
#define endl '\n'
#define ll long long
#define PII pair<ll,ll>
#define all(x) x.begin(),x.end()
const int N = 1e6 + 50;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const ll MOD = 1e9 + 7;

ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}

ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}

ll qpow(ll a, ll b, ll mod) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}

ll bit(ll a) {
	if (a <= 0) return 1;
	ll cnt = 0;
	while (a) {
		cnt++;
		a >>= 1;
	}
	return cnt;
}

void solve() {
	ll n;
	cin >> n;
	multiset<ll>st;
	for (int i = 1; i <= n; i++) {
		ll x, y;
		cin >> x >> y;
		if(x == 1){
			st.insert(y);
		}else{
			auto u = st.begin();
			while(u != st.end() && *u <= y){
				u = st.erase(u);
			}
		}
		cout << st.size() << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	ll t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

提出情報

提出日時
問題 C - Understory
ユーザ persuade123456
言語 C++23 (GCC 15.2.0)
得点 300
コード長 1282 Byte
結果 AC
実行時間 135 ms
メモリ 17696 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 13
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3604 KiB
00_sample_01.txt AC 1 ms 3480 KiB
01_random_00.txt AC 28 ms 3580 KiB
01_random_01.txt AC 34 ms 3580 KiB
01_random_02.txt AC 40 ms 3596 KiB
01_random_03.txt AC 46 ms 3548 KiB
01_random_04.txt AC 135 ms 17696 KiB
01_random_05.txt AC 60 ms 6536 KiB
01_random_06.txt AC 70 ms 9512 KiB
01_random_07.txt AC 73 ms 10632 KiB
01_random_08.txt AC 69 ms 10600 KiB
01_random_09.txt AC 94 ms 10632 KiB
01_random_10.txt AC 40 ms 3596 KiB