結果

問題 No.2422 regisys?
ユーザー LaFolia13LaFolia13
提出日時 2023-07-29 19:20:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,257 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 174,572 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2024-04-16 23:40:24
合計ジャッジ時間 12,600 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 124 ms
6,272 KB
testcase_32 AC 285 ms
11,264 KB
testcase_33 AC 103 ms
5,632 KB
testcase_34 AC 107 ms
7,040 KB
testcase_35 WA -
testcase_36 AC 188 ms
9,216 KB
testcase_37 AC 281 ms
11,008 KB
testcase_38 AC 222 ms
10,496 KB
testcase_39 AC 145 ms
8,224 KB
testcase_40 WA -
testcase_41 AC 129 ms
7,552 KB
testcase_42 WA -
testcase_43 AC 172 ms
8,064 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 187 ms
7,936 KB
testcase_48 WA -
testcase_49 AC 253 ms
9,472 KB
testcase_50 AC 181 ms
6,656 KB
testcase_51 AC 482 ms
14,976 KB
testcase_52 AC 101 ms
5,504 KB
testcase_53 WA -
testcase_54 AC 439 ms
14,464 KB
testcase_55 AC 271 ms
9,984 KB
testcase_56 AC 331 ms
13,056 KB
testcase_57 AC 584 ms
15,872 KB
testcase_58 AC 570 ms
15,744 KB
testcase_59 AC 562 ms
15,744 KB
testcase_60 AC 589 ms
15,744 KB
testcase_61 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   28 |   for (auto &[A, B]: ab) {
      |              ^
main.cpp:31:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   31 |   for (auto &[A, B]: ab) {
      |              ^
main.cpp:47:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   47 |   for (auto [a, b]: ab) {
      |             ^

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

struct AB {
  llong A;
  llong B;
  const bool operator<(const AB &ri) const {
    return max(A, B) < max(ri.A, ri.B);
  }
};

int main() {
  llong N, M;
  vector<AB> ab;
  set<llong> ippan, buin;

  cin >> N >> M;
  ab.resize(N);
  for (auto &[A, B]: ab) {
    cin >> A;
  }
  for (auto &[A, B]: ab) {
    cin >> B;
  }
  for (int i = 0; i < M; i++) {
    llong T, C;
    cin >> T >> C;
    if (T == 0) {
      ippan.insert(C);
    }
    else {
      buin.insert(C);
    }
  }
  sort(ALL(ab));
  reverse(ALL(ab));
  int cnt = 0;
  for (auto [a, b]: ab) {
    auto it1 = ippan.lower_bound(a);
    auto it2 = buin.lower_bound(b);
    if (it1 == ippan.end() && it2 == buin.end()) {
      continue;
    }
    else if (it2 == buin.end()) {
      cnt++;
      ippan.erase(it1);
    }
    else if (it1 == ippan.end()) {
      cnt++;
      buin.erase(it2);
    }
    else if (*it1 < *it2) {
      cnt++;
      ippan.erase(it1);
    }
    else {
      cnt++;
      buin.erase(it2);
    }
  }

  cout << N - cnt << endl;

  return 0;
}
0