結果

問題 No.1400 すごろくで世界旅行
ユーザー convexineqconvexineq
提出日時 2021-02-19 23:14:34
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 447 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 76,468 KB
最終ジャッジ日時 2023-10-16 22:56:02
合計ジャッジ時間 7,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,544 KB
testcase_01 AC 35 ms
53,548 KB
testcase_02 AC 36 ms
53,544 KB
testcase_03 AC 45 ms
63,556 KB
testcase_04 AC 35 ms
53,552 KB
testcase_05 AC 40 ms
59,324 KB
testcase_06 AC 59 ms
74,820 KB
testcase_07 AC 64 ms
74,828 KB
testcase_08 AC 46 ms
63,500 KB
testcase_09 AC 44 ms
63,488 KB
testcase_10 AC 48 ms
67,596 KB
testcase_11 AC 45 ms
63,500 KB
testcase_12 AC 106 ms
75,000 KB
testcase_13 AC 277 ms
76,468 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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