結果

問題 No.74 貯金箱の退屈
ユーザー 👑 colognecologne
提出日時 2022-01-25 19:48:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 701 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 76,064 KB
最終ジャッジ日時 2023-08-22 15:07:59
合計ジャッジ時間 4,496 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,140 KB
testcase_01 AC 68 ms
71,104 KB
testcase_02 AC 69 ms
71,148 KB
testcase_03 AC 72 ms
75,624 KB
testcase_04 AC 77 ms
75,572 KB
testcase_05 AC 72 ms
75,596 KB
testcase_06 AC 72 ms
75,732 KB
testcase_07 AC 72 ms
75,700 KB
testcase_08 AC 73 ms
75,636 KB
testcase_09 AC 73 ms
75,648 KB
testcase_10 AC 72 ms
75,584 KB
testcase_11 AC 71 ms
75,684 KB
testcase_12 AC 72 ms
75,452 KB
testcase_13 AC 85 ms
75,784 KB
testcase_14 AC 81 ms
76,064 KB
testcase_15 AC 82 ms
75,800 KB
testcase_16 AC 79 ms
75,776 KB
testcase_17 AC 74 ms
75,496 KB
testcase_18 AC 70 ms
71,156 KB
testcase_19 AC 74 ms
75,508 KB
testcase_20 AC 81 ms
75,708 KB
testcase_21 AC 83 ms
75,872 KB
testcase_22 AC 72 ms
71,076 KB
testcase_23 AC 71 ms
70,952 KB
testcase_24 AC 81 ms
75,812 KB
testcase_25 AC 80 ms
75,572 KB
testcase_26 AC 81 ms
75,856 KB
testcase_27 AC 80 ms
75,852 KB
testcase_28 AC 80 ms
75,736 KB
testcase_29 AC 81 ms
75,732 KB
testcase_30 AC 82 ms
75,700 KB
testcase_31 AC 82 ms
75,804 KB
testcase_32 AC 74 ms
75,612 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