結果

問題 No.3029 オイラー標数
ユーザー tobbie
提出日時 2025-04-12 17:15:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 768 ms / 2,000 ms
コード長 837 bytes
コンパイル時間 2,344 ms
コンパイル使用メモリ 207,800 KB
実行使用メモリ 37,888 KB
最終ジャッジ日時 2025-04-12 17:16:00
合計ジャッジ時間 17,413 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, n) for (int i = 0; i < (int)n; i++)

struct doub {
  int a;
  int b;
  bool operator < (const doub &rhs) const {
    if (a != rhs.a)
      return a < rhs.a;
    else
      return b < rhs.b;
  }
};

struct trip {
  int a;
  int b;
  int c;
  bool operator < (const trip &rhs) const {
    if (a != rhs.a)
      return a < rhs.a;
    else if (b != rhs.b)
      return b < rhs.b;
    else
      return c < rhs.c;
  }
};

int main() {
  int q;
  cin >> q;
  set<int> v;
  set<doub> e;
  set<trip> f;
  rep(i, q) {
    int a, b, c;
    cin >> a >> b >> c;
    v.insert(a);
    v.insert(b);
    v.insert(c);
    e.insert({a, b});
    e.insert({b, c});
    e.insert({a, c});
    f.insert({a, b, c});
  }
  cout << (int)v.size() - (int)e.size() + (int)f.size() << endl;
  return 0;
}
0