結果
問題 | No.408 五輪ピック |
ユーザー | nebukuro09 |
提出日時 | 2018-01-12 04:10:31 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 222 ms / 5,000 ms |
コード長 | 1,353 bytes |
コンパイル時間 | 595 ms |
コンパイル使用メモリ | 101,096 KB |
実行使用メモリ | 14,496 KB |
最終ジャッジ日時 | 2023-09-03 18:04:59 |
合計ジャッジ時間 | 3,739 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 48 ms
11,044 KB |
testcase_06 | AC | 26 ms
4,376 KB |
testcase_07 | AC | 39 ms
6,704 KB |
testcase_08 | AC | 36 ms
8,028 KB |
testcase_09 | AC | 35 ms
8,044 KB |
testcase_10 | AC | 27 ms
4,380 KB |
testcase_11 | AC | 24 ms
4,376 KB |
testcase_12 | AC | 46 ms
8,744 KB |
testcase_13 | AC | 46 ms
10,504 KB |
testcase_14 | AC | 9 ms
4,376 KB |
testcase_15 | AC | 50 ms
5,920 KB |
testcase_16 | AC | 54 ms
10,084 KB |
testcase_17 | AC | 49 ms
10,008 KB |
testcase_18 | AC | 51 ms
10,504 KB |
testcase_19 | AC | 54 ms
9,800 KB |
testcase_20 | AC | 14 ms
4,376 KB |
testcase_21 | AC | 9 ms
4,376 KB |
testcase_22 | AC | 23 ms
4,380 KB |
testcase_23 | AC | 66 ms
11,544 KB |
testcase_24 | AC | 48 ms
10,604 KB |
testcase_25 | AC | 125 ms
14,496 KB |
testcase_26 | AC | 57 ms
10,804 KB |
testcase_27 | AC | 222 ms
13,968 KB |
testcase_28 | AC | 30 ms
6,120 KB |
testcase_29 | AC | 29 ms
5,396 KB |
testcase_30 | AC | 1 ms
4,376 KB |
testcase_31 | AC | 1 ms
4,380 KB |
ソースコード
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]) { if (j < i) continue; 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; auto il = VU[i].keys.length; auto jl = VU[j].keys.length; if (il == 1 && jl == 1 && VU[i].keys[0] != VU[j].keys[0]) ok = true; if (il > 0 && jl > 0 && max(il, jl) > 1) ok = true; if (ij) VU[i][j] = true; if (ji) VU[j][i] = true; if (ok) break; } if (ok) break; } writeln(ok ? "YES" : "NO"); }