結果
問題 | No.1400 すごろくで世界旅行 |
ユーザー | CuriousFairy315 |
提出日時 | 2019-12-31 12:31:44 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,078 bytes |
コンパイル時間 | 3,405 ms |
コンパイル使用メモリ | 77,508 KB |
実行使用メモリ | 48,664 KB |
最終ジャッジ日時 | 2024-05-06 09:59:54 |
合計ジャッジ時間 | 8,581 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 106 ms
40,496 KB |
testcase_01 | WA | - |
testcase_02 | AC | 115 ms
41,416 KB |
testcase_03 | AC | 153 ms
41,740 KB |
testcase_04 | WA | - |
testcase_05 | AC | 127 ms
41,512 KB |
testcase_06 | AC | 174 ms
42,292 KB |
testcase_07 | AC | 208 ms
42,676 KB |
testcase_08 | AC | 153 ms
41,448 KB |
testcase_09 | AC | 150 ms
41,612 KB |
testcase_10 | AC | 159 ms
41,716 KB |
testcase_11 | AC | 146 ms
41,400 KB |
testcase_12 | AC | 332 ms
44,904 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | WA | - |
testcase_17 | AC | 436 ms
48,328 KB |
testcase_18 | RE | - |
testcase_19 | AC | 97 ms
39,852 KB |
testcase_20 | WA | - |
ソースコード
package yukicoder_3785; import java.util.BitSet; import java.util.Scanner; public class Main2 { public static void main(String[] args) { new Main2(); } public Main2() { try (Scanner sc = new Scanner(System.in)) { int V, D; V = sc.nextInt(); D = sc.nextInt(); BitSet[] graph = new BitSet[V]; for (int i = 0;i < V;++ i) { graph[i] = new BitSet(V); String E = sc.next(); for (int j = 0;j < V;++ j) graph[i].set(j, E.charAt(j) == '1'); } boolean ans = graph[0].cardinality() > 0; for (int i = 0;i < V;++ i) { BitSet now = (BitSet)graph[i].clone(), one = new BitSet(V), two = new BitSet(V), three = new BitSet(V); one.set(i); for (int j = 1;j < D;++ j) { BitSet check = (BitSet)now.clone(); check.xor(two); if (check.isEmpty()) break; two = (BitSet)one.clone(); for (int k = check.nextSetBit(0);k >= 0;k = check.nextSetBit(k + 1)) one.or(graph[k]); three = now; now = one; one = three; } ans &= now.cardinality() == V; } System.out.println(ans ? "Yes" : ":("); } } }