結果
問題 |
No.2422 regisys?
|
ユーザー |
![]() |
提出日時 | 2023-08-12 15:19:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,241 bytes |
コンパイル時間 | 1,877 ms |
コンパイル使用メモリ | 202,324 KB |
最終ジャッジ日時 | 2025-02-16 06:07:44 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 WA * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using T = tuple<ll, ll, ll>; // #include <atcoder/all> // using namespace atcoder; // using mint = modint1000000007; #define rep(i, n) for(ll i = 0; i < n; i++) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n,m; cin >> n >> m; priority_queue<P,vector<P>,greater<P>> a, b, mem; rep(i,n) { ll aa; cin >> aa; a.push(P(aa,i)); } rep(i,n) { ll bb; cin >> bb; b.push(P(bb,i)); } rep(i,m) { ll t,c; cin >> t >> c; mem.push(P(c,t)); } ll ans = 0; set<ll> bought; while( !mem.empty() ) { auto [money,t] = mem.top(); mem.pop(); if( t == 0 ) { while( !a.empty() && bought.count(a.top().second) ) a.pop(); if( !a.empty() && a.top().first <= money ) { ans++; a.pop(); } } else { while( !b.empty() && bought.count(b.top().second) ) b.pop(); if( !b.empty() && b.top().first <= money ) { ans++; b.pop(); } } } cout << n-ans << endl; return 0; }