結果
| 問題 |
No.2422 regisys?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-19 14:54:35 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,525 bytes |
| コンパイル時間 | 5,981 ms |
| コンパイル使用メモリ | 132,684 KB |
| 実行使用メモリ | 8,700 KB |
| 最終ジャッジ日時 | 2024-09-19 13:54:30 |
| 合計ジャッジ時間 | 8,770 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 60 WA * 1 |
ソースコード
#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<pair<int, int>> ab(n);
for (int i = 0; i < n; ++i) cin >> ab[i].first;
for (int i = 0; i < n; ++i) cin >> ab[i].second;
vector<int> t0, t1;
for (int i = 0; i < m; ++i) {
int t, c;
cin >> t >> c;
if (t == 0) {
t0.push_back(c);
} else {
t1.push_back(c);
}
}
sort(t0.begin(), t0.end());
sort(t1.begin(), t1.end());
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> small;
priority_queue<int> large;
for (int i = 0; i < n; ++i) {
small.emplace(ab[i]);
}
for (const auto x : t0) {
while (small.size() && small.top().first <= x) {
auto [a, b] = small.top();
small.pop();
large.emplace(b);
}
if (large.empty()) {
continue;
}
large.pop();
}
vector<int> min_v;
while (small.size()) {
auto [a, b] = small.top();
small.pop();
min_v.push_back(b);
}
while (large.size()) {
min_v.push_back(large.top());
large.pop();
}
sort(min_v.rbegin(), min_v.rend());
for (const auto x : t1) {
if (min_v.empty()) {
break;
}
if (min_v.back() < x) {
min_v.pop_back();
}
}
cout << min_v.size() << endl;
return 0;
}