結果

問題 No.408 五輪ピック
ユーザー nebukuro09nebukuro09
提出日時 2017-06-10 12:03:34
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,257 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 102,860 KB
実行使用メモリ 14,920 KB
最終ジャッジ日時 2023-09-03 14:10:54
合計ジャッジ時間 16,014 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 28 ms
4,452 KB
testcase_07 AC 44 ms
8,056 KB
testcase_08 AC 44 ms
8,208 KB
testcase_09 AC 39 ms
6,724 KB
testcase_10 WA -
testcase_11 AC 27 ms
4,376 KB
testcase_12 AC 51 ms
8,528 KB
testcase_13 AC 81 ms
11,084 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 80 ms
11,084 KB
testcase_17 AC 59 ms
9,828 KB
testcase_18 AC 58 ms
9,836 KB
testcase_19 AC 61 ms
10,044 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 24 ms
4,376 KB
testcase_23 AC 128 ms
14,460 KB
testcase_24 AC 61 ms
10,620 KB
testcase_25 WA -
testcase_26 AC 62 ms
10,816 KB
testcase_27 AC 259 ms
14,380 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.d(39): Warning: else is dangling, add { } after condition at Main.d(36)

ソースコード

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 bool[int][](N);

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


    bool ok = false;
    
    foreach (i; 1..N) {
        foreach (j; edges[i]) {
            bool ij, ji;
            if (j in VU[i]) VU[i].remove(j), ij = true;
            if (i in VU[j]) VU[j].remove(i), ji = true;
            if (VU[i].keys.length == 1 && VU[j].keys.length == 1)
                if (VU[i].keys[0] != VU[j].keys[0])
                    ok = true;
            else if (VU[i].keys.length > 0 && VU[j].keys.length > 0)
                ok = true;

            if (ij) VU[i][j] = true;
            if (ji) VU[j][i] = true;
        }
    }

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