結果

問題 No.2422 regisys?
ユーザー LaFolia13
提出日時 2023-07-29 19:16:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,237 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 178,448 KB
実行使用メモリ 15,744 KB
最終ジャッジ日時 2024-10-08 06:34:06
合計ジャッジ時間 13,012 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 52 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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