結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 2 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 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 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 3 ms
5,376 KB
testcase_31 AC 120 ms
6,272 KB
testcase_32 AC 256 ms
11,264 KB
testcase_33 AC 98 ms
5,632 KB
testcase_34 AC 100 ms
7,040 KB
testcase_35 WA -
testcase_36 AC 189 ms
9,216 KB
testcase_37 AC 266 ms
11,008 KB
testcase_38 AC 215 ms
10,572 KB
testcase_39 AC 134 ms
8,352 KB
testcase_40 WA -
testcase_41 AC 120 ms
7,680 KB
testcase_42 WA -
testcase_43 AC 163 ms
8,192 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 172 ms
8,064 KB
testcase_48 WA -
testcase_49 AC 227 ms
9,472 KB
testcase_50 AC 180 ms
6,528 KB
testcase_51 AC 444 ms
14,976 KB
testcase_52 AC 96 ms
5,504 KB
testcase_53 WA -
testcase_54 AC 405 ms
14,464 KB
testcase_55 AC 261 ms
9,984 KB
testcase_56 AC 313 ms
13,184 KB
testcase_57 AC 503 ms
15,744 KB
testcase_58 AC 506 ms
15,744 KB
testcase_59 AC 495 ms
15,744 KB
testcase_60 AC 500 ms
15,744 KB
testcase_61 AC 1 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:46:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   46 |   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 min(A, B) < min(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));
  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