結果

問題 No.408 五輪ピック
ユーザー nebukuro09nebukuro09
提出日時 2017-06-10 11:37:10
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 970 bytes
コンパイル時間 2,310 ms
コンパイル使用メモリ 100,892 KB
実行使用メモリ 11,084 KB
最終ジャッジ日時 2023-09-03 14:10:18
合計ジャッジ時間 4,108 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 54 ms
11,016 KB
testcase_06 AC 28 ms
6,192 KB
testcase_07 AC 43 ms
7,988 KB
testcase_08 AC 39 ms
7,932 KB
testcase_09 AC 39 ms
7,436 KB
testcase_10 AC 28 ms
4,412 KB
testcase_11 AC 27 ms
4,380 KB
testcase_12 AC 49 ms
8,716 KB
testcase_13 AC 52 ms
10,276 KB
testcase_14 AC 11 ms
4,384 KB
testcase_15 AC 57 ms
4,380 KB
testcase_16 AC 56 ms
9,820 KB
testcase_17 AC 56 ms
9,624 KB
testcase_18 AC 55 ms
9,836 KB
testcase_19 AC 58 ms
10,084 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 8 ms
4,500 KB
testcase_22 AC 24 ms
4,380 KB
testcase_23 AC 72 ms
11,084 KB
testcase_24 WA -
testcase_25 AC 59 ms
11,028 KB
testcase_26 AC 60 ms
10,760 KB
testcase_27 AC 60 ms
11,056 KB
testcase_28 AC 32 ms
4,384 KB
testcase_29 AC 32 ms
4,388 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable int INF = 1 << 28;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto edges = new int[][](N);
    foreach (i; 0..M) {
        s = readln.split.map!(to!int);
        edges[s[0] - 1] ~= s[1] - 1;
        edges[s[1] - 1] ~= s[0] - 1;
    }


    auto VU = new int[][](N);

    foreach (u; edges[0]) {
        foreach (v; edges[u]) {
            if (v != 0)
                VU[v] ~= u;
        }
    }


    bool ok = false;
    
    foreach (i; 1..N) {
        foreach (j; edges[i]) {
            if (VU[i].length == 0 || VU[j].length == 0) continue;
            if (VU[i].length == 1 && VU[j].length == 1 && VU[i][0] == VU[j][0]) continue;
            ok = true;
        }
    }

    writeln(ok ? "YES" : "NO");
}
0