結果

問題 No.2422 regisys?
ユーザー a01sa01toa01sa01to
提出日時 2023-08-12 14:54:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,074 bytes
コンパイル時間 2,450 ms
コンパイル使用メモリ 213,012 KB
実行使用メモリ 25,216 KB
最終ジャッジ日時 2024-04-30 07:28:37
合計ジャッジ時間 12,828 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,948 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 WA -
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 1 ms
6,944 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 151 ms
11,264 KB
testcase_32 AC 191 ms
10,752 KB
testcase_33 AC 142 ms
11,136 KB
testcase_34 AC 75 ms
6,940 KB
testcase_35 AC 175 ms
13,312 KB
testcase_36 AC 137 ms
8,320 KB
testcase_37 AC 212 ms
11,776 KB
testcase_38 AC 130 ms
7,040 KB
testcase_39 AC 91 ms
6,940 KB
testcase_40 AC 87 ms
8,064 KB
testcase_41 AC 96 ms
6,940 KB
testcase_42 AC 319 ms
20,480 KB
testcase_43 AC 154 ms
9,984 KB
testcase_44 AC 383 ms
21,120 KB
testcase_45 AC 296 ms
18,432 KB
testcase_46 AC 375 ms
20,864 KB
testcase_47 AC 207 ms
12,928 KB
testcase_48 AC 358 ms
23,040 KB
testcase_49 AC 274 ms
15,488 KB
testcase_50 AC 320 ms
22,144 KB
testcase_51 AC 447 ms
21,760 KB
testcase_52 AC 144 ms
11,776 KB
testcase_53 AC 396 ms
21,248 KB
testcase_54 AC 475 ms
24,448 KB
testcase_55 AC 364 ms
21,760 KB
testcase_56 AC 267 ms
14,848 KB
testcase_57 AC 556 ms
25,088 KB
testcase_58 AC 560 ms
25,088 KB
testcase_59 AC 553 ms
25,216 KB
testcase_60 AC 585 ms
25,088 KB
testcase_61 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  multiset<pair<int, int>> general, mma;
  rep(i, n) {
    general.insert({ a[i], b[i] });
    mma.insert({ b[i], a[i] });
  }
  vector<pair<int, int>> q(m);
  rep(i, m) cin >> q[i].first >> q[i].second;
  sort(q.begin(), q.end(), [](auto a, auto b) {
    return a.second < b.second;
  });
  rep(i, m) {
    auto [t, c] = q[i];
    auto&& my = (t == 0 ? general : mma);
    auto&& opp = (t == 0 ? mma : general);

    auto itr = my.upper_bound({ c, 2e9 });
    if (itr == my.begin()) continue;
    auto [a, b] = *prev(itr);
    auto itr1 = my.find({ a, b });
    my.erase(itr1);
    auto itr2 = opp.find({ b, a });
    opp.erase(itr2);
  }
  assert(general.size() == mma.size());
  cout << general.size() << endl;
  return 0;
}
0