結果
問題 | No.1400 すごろくで世界旅行 |
ユーザー | takelifetime |
提出日時 | 2021-02-19 23:56:23 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 2,219 ms |
コンパイル使用メモリ | 81,636 KB |
実行使用メモリ | 420,436 KB |
最終ジャッジ日時 | 2023-10-17 00:55:31 |
合計ジャッジ時間 | 10,706 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,536 KB |
testcase_01 | AC | 36 ms
53,536 KB |
testcase_02 | AC | 36 ms
53,536 KB |
testcase_03 | AC | 78 ms
76,080 KB |
testcase_04 | AC | 57 ms
68,508 KB |
testcase_05 | AC | 59 ms
70,660 KB |
testcase_06 | AC | 144 ms
79,224 KB |
testcase_07 | AC | 251 ms
79,056 KB |
testcase_08 | AC | 82 ms
76,136 KB |
testcase_09 | AC | 81 ms
76,084 KB |
testcase_10 | AC | 105 ms
76,456 KB |
testcase_11 | AC | 73 ms
76,108 KB |
testcase_12 | AC | 1,308 ms
114,960 KB |
testcase_13 | MLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
ソースコード
v, d = map(int, input().split()) e = [list(map(int, list(input()))) for _ in range(v)] def power(a, b): c = [[0] * v for _ in range(v)] for i in range(v): for j in range(v): for k in range(v): if a[i][k] & b[k][j]: c[i][j] = 1 break return c digits = len(bin(d)[2:]) ans = [[1 if i == j else 0 for j in range(v)] for i in range(v)] for i in range(digits): if d & 1: ans = power(ans, e) e = power(e, e) d >>= 1 for row in ans: for x in row: if x == 0: print("No") exit() print("Yes")