結果

問題 No.1400 すごろくで世界旅行
ユーザー convexineq
提出日時 2021-02-19 23:14:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-09-16 22:40:44
合計ジャッジ時間 6,356 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(i):
    p = 1<<i
    for _ in range(min(d,4001)):
        np = j = 0
        while p:
            if p&1: np |= e[j]
            p >>= 1
            j += 1
        if np == M: return True
        p = np
    return False

import sys
input = sys.stdin.readline
v,d = map(int,input().split())
e = [int(input()[::-1],2) for _ in range(v)]
M = (1<<v) - 1
for i in range(v):
    if not check(i):
        print("No")
        exit()
print("Yes")
0