結果

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

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int Q;
    cin >> Q;
    vector<int> V;
    vector<pair<int,int>> E;
    vector<tuple<int,int,int>> F;
    array<int,3> ary;
    while(Q--){
        int a, b, c;
        cin >> a >> b >> c;
        V.emplace_back(a);
        V.emplace_back(b);
        V.emplace_back(c);
        E.emplace_back(minmax(a, b));
        E.emplace_back(minmax(b, c));
        E.emplace_back(minmax(c, a));
        ary = {a, b, c};
        sort(ary.begin(), ary.end());
        F.emplace_back(ary[0], ary[1], ary[2]);
    }
    sort(V.begin(), V.end());
    V.erase(unique(V.begin(), V.end()), V.end());
    sort(E.begin(), E.end());
    E.erase(unique(E.begin(), E.end()), E.end());
    sort(F.begin(), F.end());
    F.erase(unique(F.begin(), F.end()), F.end());
    cout << (int)(V.size()) - (int)(E.size()) + (int)(F.size()) << '\n';
}
0