結果

問題 No.1400 すごろくで世界旅行
ユーザー convexineqconvexineq
提出日時 2021-02-19 23:13:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-09-16 22:38:01
合計ジャッジ時間 4,391 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 7 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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
        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