結果

問題 No.1390 Get together
ユーザー ninoinuininoinui
提出日時 2021-02-12 21:41:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 207,136 KB
実行使用メモリ 30,988 KB
最終ジャッジ日時 2023-09-27 03:24:50
合計ジャッジ時間 6,972 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,384 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 69 ms
21,440 KB
testcase_17 AC 174 ms
27,384 KB
testcase_18 AC 92 ms
24,944 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template <class A, class B> bool cmin(A& a, B b) { return a > b && (a = b, true); }
template <class A, class B> bool cmax(A& a, B b) { return a < b && (a = b, true); }

signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);

  long N, M;
  cin >> N >> M;
  vector<pair<long, long>> V(N);
  for (long i = 0; i < N; i++) {
    long a, b;
    cin >> a >> b, a--, b--;
    V.at(i) = {a, b};
  }

  vector<set<long>> V2(M);
  for (const auto& [a, b] : V) V2.at(a).insert(b);

  long ans = 0;
  set<long> SE;
  for (const auto& se : V2) {
    bool b = 0;
    for (const auto& a : se) {
      if (SE.count(a)) {
        b = 1;
      } else {
        SE.insert(a);
      }
    }
    if (b) ans++;
  }
  cout << ans << '\n';
}
0