結果

問題 No.2442 線形写像
ユーザー 👑 KazunKazun
提出日時 2023-08-26 00:53:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 85,080 KB
最終ジャッジ日時 2023-08-26 12:19:00
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,632 KB
testcase_01 AC 67 ms
71,432 KB
testcase_02 AC 67 ms
71,148 KB
testcase_03 AC 65 ms
71,292 KB
testcase_04 AC 67 ms
71,124 KB
testcase_05 AC 65 ms
71,344 KB
testcase_06 AC 65 ms
71,448 KB
testcase_07 AC 67 ms
71,424 KB
testcase_08 AC 69 ms
71,460 KB
testcase_09 AC 65 ms
71,616 KB
testcase_10 AC 73 ms
75,996 KB
testcase_11 AC 75 ms
76,236 KB
testcase_12 AC 75 ms
76,064 KB
testcase_13 AC 75 ms
76,032 KB
testcase_14 AC 75 ms
75,996 KB
testcase_15 AC 111 ms
78,020 KB
testcase_16 AC 113 ms
78,032 KB
testcase_17 AC 204 ms
85,080 KB
testcase_18 AC 151 ms
78,592 KB
testcase_19 AC 155 ms
78,556 KB
testcase_20 AC 151 ms
78,612 KB
testcase_21 AC 204 ms
85,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input())

    A = [0] * (1 << N)
    for i in range(1 << N):
        A[i] = int(input())

    bit = lambda S, k : (S >> k) & 1
    def xor_sum(S):
        xor = 0
        for j in range(N):
            if bit(S, j):
                xor ^= A[1 << j]
        return xor

    return all(A[S] == xor_sum(S) for S in range(1 << N))

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

print("Yes" if solve() else "No")
0