結果

問題 No.408 五輪ピック
ユーザー t98slidert98slider
提出日時 2022-07-18 02:27:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 1,843 ms
コンパイル使用メモリ 173,188 KB
実行使用メモリ 4,884 KB
最終ジャッジ日時 2023-09-12 13:51:26
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 22 ms
4,380 KB
testcase_06 AC 16 ms
4,380 KB
testcase_07 AC 24 ms
4,380 KB
testcase_08 AC 18 ms
4,380 KB
testcase_09 AC 19 ms
4,376 KB
testcase_10 AC 16 ms
4,376 KB
testcase_11 AC 15 ms
4,376 KB
testcase_12 AC 26 ms
4,716 KB
testcase_13 AC 22 ms
4,376 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 22 ms
4,380 KB
testcase_16 AC 25 ms
4,376 KB
testcase_17 AC 27 ms
4,452 KB
testcase_18 AC 29 ms
4,460 KB
testcase_19 AC 31 ms
4,564 KB
testcase_20 AC 9 ms
4,380 KB
testcase_21 AC 5 ms
4,376 KB
testcase_22 AC 14 ms
4,380 KB
testcase_23 AC 31 ms
4,876 KB
testcase_24 WA -
testcase_25 AC 22 ms
4,380 KB
testcase_26 AC 33 ms
4,884 KB
testcase_27 AC 22 ms
4,380 KB
testcase_28 AC 17 ms
4,380 KB
testcase_29 AC 17 ms
4,376 KB
testcase_30 WA -
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);
    int cnt = 0;
    for(auto &&u:g[0]){
        cnt++;
        for(auto &&v:g[u]){
            used[v] ^= cnt;
        }
    }
    used[0] = 0;
    for(int i = 0; i < m; i++){
        tie(u, v) = edge[i];
        if(used[u] >= 1 && used[v] >= 1 && (used[u] ^ used[v])){
            cout << "YES" << '\n';
            return 0;
        }
    }
    cout << "NO" << '\n';
}
0