結果

問題 No.3029 オイラー標数
ユーザー haihamabossu
提出日時 2025-02-21 22:04:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 695 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 2,315 ms
コンパイル使用メモリ 208,880 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2025-02-21 22:04:50
合計ジャッジ時間 13,685 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve() {
  ll q;
  cin >> q;
  set<ll> v;
  set<pair<ll, ll>> e;
  set<tuple<ll, ll, ll>> f;
  rep(qi, q) {
    ll a, b, c;
    cin >> a >> b >> c;
    v.insert(a);
    v.insert(b);
    v.insert(c);
    e.emplace(a, b);
    e.emplace(b, c);
    e.emplace(a, c);
    f.emplace(a, b, c);
  }
  ll ans = ll(v.size());
  ans -= ll(e.size());
  ans += ll(f.size());
  cout << ans << '\n';
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int T = 1;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
0