結果

問題 No.3029 オイラー標数
ユーザー Andrew8128
提出日時 2025-02-21 22:00:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 820 bytes
コンパイル時間 4,485 ms
コンパイル使用メモリ 303,584 KB
実行使用メモリ 10,872 KB
最終ジャッジ日時 2025-02-21 22:00:14
合計ジャッジ時間 7,627 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#pragma GCC optimize("O3")
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int Q;
  cin >> Q;
  vector<int> V;
  vector<array<int, 2>> E;
  vector<array<int, 3>> F;
  for (int i = 0; i < Q; i++) {
    int A, B, C;
    cin >> A >> B >> C;
    V.push_back(A);
    V.push_back(B);
    V.push_back(C);
    E.push_back({A, B});
    E.push_back({B, C});
    E.push_back({A, C});
    F.push_back({A, B, C});
  }
  ranges::sort(V);
  ranges::sort(E);
  ranges::sort(F);
  int ans = 0;
  ans += unique(V.begin(), V.end()) - V.begin();
  ans -= unique(E.begin(), E.end()) - E.begin();
  ans += unique(F.begin(), F.end()) - F.begin();
  cout << ans << '\n';
  return 0;
}
/*
  File : ~/yukicoder/528/C.cpp
  Date : 2025/02/21
  Time : 21:52:29
*/
0