結果

問題 No.408 五輪ピック
ユーザー t98slidert98slider
提出日時 2022-07-18 02:35:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 173,404 KB
実行使用メモリ 5,084 KB
最終ジャッジ日時 2023-09-12 13:58:01
合計ジャッジ時間 3,560 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 22 ms
4,380 KB
testcase_06 AC 16 ms
4,432 KB
testcase_07 AC 23 ms
4,684 KB
testcase_08 AC 18 ms
4,376 KB
testcase_09 AC 19 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 15 ms
4,376 KB
testcase_12 AC 26 ms
4,556 KB
testcase_13 AC 22 ms
4,384 KB
testcase_14 WA -
testcase_15 AC 22 ms
4,376 KB
testcase_16 AC 24 ms
4,384 KB
testcase_17 AC 27 ms
4,384 KB
testcase_18 AC 29 ms
4,388 KB
testcase_19 AC 31 ms
4,552 KB
testcase_20 AC 9 ms
4,380 KB
testcase_21 AC 6 ms
4,380 KB
testcase_22 AC 15 ms
4,380 KB
testcase_23 AC 31 ms
4,864 KB
testcase_24 WA -
testcase_25 AC 22 ms
4,376 KB
testcase_26 AC 32 ms
5,084 KB
testcase_27 AC 22 ms
4,380 KB
testcase_28 AC 18 ms
4,388 KB
testcase_29 AC 17 ms
4,384 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n, m, u, v;
    cin >> n >> m;
    vector<vector<int>> g(n);
    vector<pair<int,int>> edge(m);
    for(int i = 0; i < m; i++){
        cin >> u >> v;
        edge[i] = {--u, -- v};
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector<int> used(n), val(n);
    for(auto &&u:g[0]){
        val[u] = rand();
        for(auto &&v:g[u]){
            used[v] += val[u];
        }
    }
    used[0] = 0;
    for(int i = 0; i < m; i++){
        tie(u, v) = edge[i];
        if(used[u] && used[v] && (used[u] + used[v] != val[u] + val[v])){
            cout << "YES" << '\n';
            return 0;
        }
    }
    cout << "NO" << '\n';
}
0