結果

問題 No.2422 regisys?
ユーザー m_99m_99
提出日時 2023-08-12 14:27:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,055 bytes
コンパイル時間 3,847 ms
コンパイル使用メモリ 239,772 KB
実行使用メモリ 14,460 KB
最終ジャッジ日時 2024-04-30 06:08:08
合計ジャッジ時間 9,119 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
6,944 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 RE -
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 AC 2 ms
6,940 KB
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 AC 97 ms
7,168 KB
testcase_34 RE -
testcase_35 AC 122 ms
8,260 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 WA -
testcase_40 WA -
testcase_41 RE -
testcase_42 AC 226 ms
12,304 KB
testcase_43 RE -
testcase_44 AC 237 ms
11,876 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 246 ms
14,020 KB
testcase_49 RE -
testcase_50 AC 222 ms
14,124 KB
testcase_51 RE -
testcase_52 AC 104 ms
7,744 KB
testcase_53 RE -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 RE -
testcase_59 WA -
testcase_60 RE -
testcase_61 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001



int main(){
	
	int n,m;
	cin>>n>>m;
	
	vector<pair<int,int>> a(n);//,b(n);
	rep(i,n)cin>>a[i].first;
	rep(i,n)cin>>a[i].second;
	//rep(i,n)cin>>b[i];
	sort(a.begin(),a.end());
	vector<vector<int>> t(2);
	rep(i,m){
		int x,y;
		cin>>x>>y;
		t[x].push_back(y);
	}
	rep(i,2)sort(t[i].begin(),t[i].end());
	
	int ans = 0;
	priority_queue<int> Q;
	int cp = 0;
	rep(i,t[0].size()){
		while(cp!=n && a[cp].first <= t[0][i]){
			Q.push(a[cp].second);
			cp++;
		}
		if(Q.size()>0){
			ans++;
			Q.pop();
		}
	}
	for(int i=cp;i<n;i++){
		Q.push(a[cp].second);
	}
	multiset<int> b;
	while(Q.size()>0){
		b.insert(Q.top());
		Q.pop();
	}
	//sort(b.rbegin(),b.rend());
	rep(i,t[1].size()){
		auto it = b.upper_bound(t[1][i]);
		if(it==b.begin())continue;
		ans++;
		b.erase(it);
	}
	cout<<n-ans<<endl;
	return 0;
}
0