結果

問題 No.74 貯金箱の退屈
ユーザー 👑 colognecologne
提出日時 2022-01-25 19:48:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 701 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 64,384 KB
最終ジャッジ日時 2024-05-09 20:51:01
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,480 KB
testcase_01 AC 41 ms
52,152 KB
testcase_02 AC 39 ms
52,480 KB
testcase_03 AC 41 ms
58,880 KB
testcase_04 AC 41 ms
58,624 KB
testcase_05 AC 42 ms
58,368 KB
testcase_06 AC 46 ms
58,240 KB
testcase_07 AC 45 ms
59,324 KB
testcase_08 AC 46 ms
58,624 KB
testcase_09 AC 45 ms
58,240 KB
testcase_10 AC 46 ms
58,240 KB
testcase_11 AC 44 ms
58,624 KB
testcase_12 AC 42 ms
58,624 KB
testcase_13 AC 48 ms
62,720 KB
testcase_14 AC 51 ms
64,000 KB
testcase_15 AC 53 ms
62,720 KB
testcase_16 AC 47 ms
60,672 KB
testcase_17 AC 41 ms
57,216 KB
testcase_18 AC 38 ms
52,072 KB
testcase_19 AC 43 ms
58,496 KB
testcase_20 AC 51 ms
62,976 KB
testcase_21 AC 55 ms
64,384 KB
testcase_22 AC 41 ms
52,608 KB
testcase_23 AC 40 ms
51,968 KB
testcase_24 AC 48 ms
61,696 KB
testcase_25 AC 47 ms
60,672 KB
testcase_26 AC 49 ms
63,104 KB
testcase_27 AC 48 ms
63,232 KB
testcase_28 AC 49 ms
63,232 KB
testcase_29 AC 48 ms
62,208 KB
testcase_30 AC 50 ms
63,232 KB
testcase_31 AC 50 ms
63,488 KB
testcase_32 AC 42 ms
58,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    *D, = map(int, input().split())
    *W, = map(int, input().split())

    target = 0
    arr = []
    for i in range(N):
        target |= (1-W[i]) << i
        L = (i-D[i]) % N
        R = (i+D[i]) % N
        arr.append((1 << L) | (1 << R))

    for i in range(N):
        ans = None
        for v in arr:
            if v & (1 << i):
                ans = v
        if ans is not None:
            if target & (1 << i):
                target ^= ans
            arr = [x ^ ans if x & (1 << i) else x for x in arr]

    print('Yes' if target == 0 else 'No')


if __name__ == '__main__':
    main()
0