結果

問題 No.1400 すごろくで世界旅行
ユーザー KudeKude
提出日時 2021-02-19 22:47:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 415 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 94,728 KB
最終ジャッジ日時 2023-10-15 03:48:06
合計ジャッジ時間 10,950 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
94,728 KB
testcase_01 AC 135 ms
29,640 KB
testcase_02 AC 134 ms
29,708 KB
testcase_03 AC 140 ms
29,616 KB
testcase_04 AC 135 ms
29,612 KB
testcase_05 AC 136 ms
29,588 KB
testcase_06 AC 157 ms
30,044 KB
testcase_07 AC 184 ms
30,352 KB
testcase_08 AC 142 ms
29,732 KB
testcase_09 AC 141 ms
29,496 KB
testcase_10 AC 150 ms
29,796 KB
testcase_11 AC 142 ms
29,600 KB
testcase_12 AC 371 ms
32,500 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys

def solve():
    v, d = map(int, input().split())
    e = np.array([list(map(int, sys.stdin.readline().rstrip())) for _ in range(v)], dtype='bool')
    now = np.identity(v, dtype='bool')
    while d:
        if d % 2:
            now = np.dot(now, e)
        e = np.dot(e, e)
        d //= 2

    if all(all(r) for r in now):
        print('Yes')
    else:
        print('No')
solve()
0