結果

問題 No.3029 オイラー標数
ユーザー zawakasu
提出日時 2025-02-21 21:40:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 1,124 bytes
コンパイル時間 1,782 ms
コンパイル使用メモリ 130,936 KB
実行使用メモリ 8,052 KB
最終ジャッジ日時 2025-02-21 21:40:38
合計ジャッジ時間 5,487 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
int Q;
int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    std::cin >> Q;
    std::vector<int> A;
    A.reserve(3 * Q);
    std::vector<std::pair<int, int>> B;
    B.reserve(3 * Q);
    std::vector<std::tuple<int, int, int>> C;
    B.reserve(Q);
    while (Q--) {
        int a, b, c;
        std::cin >> a >> b >> c;
        std::vector<int> cur{ a, b, c };
        std::sort(cur.begin(), cur.end());
        for (int i = 0 ; i < 3 ; i++) A.push_back(cur[i]);
        B.push_back({cur[0], cur[1]});
        B.push_back({cur[1], cur[2]});
        B.push_back({cur[0], cur[2]});
        C.push_back({cur[0], cur[1], cur[2]});
    }
    std::sort(A.begin(), A.end());
    A.erase(std::unique(A.begin(), A.end()), A.end());
    std::sort(B.begin(), B.end());
    B.erase(std::unique(B.begin(), B.end()), B.end());
    std::sort(C.begin(), C.end());
    C.erase(std::unique(C.begin(), C.end()), C.end());
    std::cout << (int)A.size() - (int)B.size() + (int)C.size() << '\n';
}
0