結果
問題 |
No.1390 Get together
|
ユーザー |
![]() |
提出日時 | 2021-02-12 21:41:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 1,933 ms |
コンパイル使用メモリ | 203,572 KB |
最終ジャッジ日時 | 2025-01-18 18:13:10 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 22 |
ソースコード
#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'; }