結果

問題 No.1400 すごろくで世界旅行
ユーザー Kude
提出日時 2021-02-19 22:47:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 415 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 79,048 KB
最終ジャッジ日時 2024-09-16 21:19:25
合計ジャッジ時間 14,302 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

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