結果

問題 No.1777 万華鏡美術館
ユーザー siro53siro53
提出日時 2021-12-06 13:12:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 1,867 ms
コンパイル使用メモリ 206,072 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 08:55:46
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#include <atcoder/dsu>

int main() {
    int N, M;
    cin >> N >> M;
    atcoder::dsu uf(N);
    bool ex = false;
    for(int i=0;i<M;i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        if(uf.same(u,v)) ex = true;
        uf.merge(u, v);
    }
    cout << (ex ? "4" : "5") << endl;
}
0