結果

問題 No.1400 すごろくで世界旅行
ユーザー convexineqconvexineq
提出日時 2021-02-20 01:01:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 540 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 81,528 KB
実行使用メモリ 81,752 KB
最終ジャッジ日時 2023-10-17 05:29:06
合計ジャッジ時間 6,835 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,376 KB
testcase_01 AC 38 ms
53,380 KB
testcase_02 AC 38 ms
53,376 KB
testcase_03 AC 50 ms
64,028 KB
testcase_04 AC 38 ms
53,384 KB
testcase_05 AC 44 ms
61,332 KB
testcase_06 AC 59 ms
72,244 KB
testcase_07 AC 66 ms
75,204 KB
testcase_08 AC 51 ms
64,020 KB
testcase_09 AC 48 ms
63,384 KB
testcase_10 AC 53 ms
68,112 KB
testcase_11 AC 48 ms
63,544 KB
testcase_12 AC 100 ms
75,424 KB
testcase_13 AC 204 ms
76,344 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(i,d):
    v = d%2
    p = dp = 0
    q = dq = 1<<i
    while d:
        np = 0
        for j,sj in enumerate(bin(dq)[:1:-1]):
            if sj=="1": np |= e[j]
        dp = np^p
        p = np|p
        d -= 1
        if p == M: return 1
        if d==0: return 0
        p,q,dp,dq = q,p,dq,dp

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