結果

問題 No.2672 Subset Xor Sum
ユーザー ThetaTheta
提出日時 2024-04-18 17:59:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 145,588 KB
最終ジャッジ日時 2024-04-18 17:59:56
合計ジャッジ時間 8,097 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
54,852 KB
testcase_01 AC 43 ms
54,400 KB
testcase_02 AC 49 ms
62,976 KB
testcase_03 AC 48 ms
61,184 KB
testcase_04 AC 47 ms
60,928 KB
testcase_05 AC 49 ms
61,952 KB
testcase_06 AC 65 ms
62,720 KB
testcase_07 AC 47 ms
61,440 KB
testcase_08 AC 47 ms
61,568 KB
testcase_09 AC 49 ms
61,440 KB
testcase_10 AC 49 ms
62,464 KB
testcase_11 AC 52 ms
62,208 KB
testcase_12 AC 48 ms
61,312 KB
testcase_13 AC 48 ms
61,696 KB
testcase_14 AC 47 ms
61,568 KB
testcase_15 AC 47 ms
61,952 KB
testcase_16 AC 48 ms
61,184 KB
testcase_17 AC 47 ms
61,312 KB
testcase_18 AC 46 ms
61,568 KB
testcase_19 AC 47 ms
61,568 KB
testcase_20 AC 48 ms
61,184 KB
testcase_21 AC 48 ms
61,952 KB
testcase_22 AC 45 ms
54,656 KB
testcase_23 AC 47 ms
54,912 KB
testcase_24 AC 48 ms
60,928 KB
testcase_25 AC 48 ms
60,800 KB
testcase_26 AC 59 ms
54,784 KB
testcase_27 AC 44 ms
54,528 KB
testcase_28 AC 48 ms
64,512 KB
testcase_29 AC 48 ms
64,000 KB
testcase_30 AC 47 ms
61,440 KB
testcase_31 AC 140 ms
136,128 KB
testcase_32 AC 81 ms
98,176 KB
testcase_33 AC 76 ms
93,184 KB
testcase_34 AC 118 ms
113,156 KB
testcase_35 AC 138 ms
136,000 KB
testcase_36 AC 122 ms
121,348 KB
testcase_37 AC 133 ms
129,372 KB
testcase_38 AC 110 ms
103,808 KB
testcase_39 AC 144 ms
145,192 KB
testcase_40 AC 62 ms
78,208 KB
testcase_41 AC 106 ms
106,296 KB
testcase_42 AC 127 ms
128,968 KB
testcase_43 AC 117 ms
113,552 KB
testcase_44 AC 143 ms
145,588 KB
testcase_45 AC 115 ms
113,304 KB
testcase_46 AC 46 ms
62,208 KB
testcase_47 AC 53 ms
66,944 KB
testcase_48 AC 47 ms
61,952 KB
testcase_49 AC 74 ms
61,696 KB
testcase_50 AC 47 ms
61,952 KB
testcase_51 AC 49 ms
64,256 KB
testcase_52 AC 47 ms
62,592 KB
testcase_53 AC 47 ms
62,592 KB
testcase_54 AC 50 ms
64,256 KB
testcase_55 AC 51 ms
65,792 KB
testcase_56 AC 49 ms
61,824 KB
testcase_57 AC 47 ms
62,592 KB
testcase_58 AC 49 ms
63,104 KB
testcase_59 AC 45 ms
55,168 KB
testcase_60 AC 47 ms
61,492 KB
testcase_61 AC 56 ms
61,440 KB
testcase_62 AC 51 ms
63,488 KB
testcase_63 AC 50 ms
63,744 KB
testcase_64 AC 48 ms
62,592 KB
testcase_65 AC 50 ms
65,024 KB
testcase_66 WA -
testcase_67 AC 44 ms
54,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
from operator import xor


def main():
    N = int(input())
    A = list(map(int, input().split()))
    if reduce(xor, A) != 0:
        print("No")
        return

    if len(set(A)) < len(A):
        print("Yes")
        return
    dp_table = [set((0,)), set()]

    for a_elm in A[:-1]:
        for xor_elm in dp_table[0]:
            dp_table[1].add(xor_elm)
            dp_table[1].add(xor_elm ^ a_elm)
            if xor_elm ^ a_elm == 0:
                print("Yes")
                return
        dp_table[0] = dp_table[1]
        dp_table[1] = set()
    print("No")


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