結果

問題 No.2672 Subset Xor Sum
ユーザー Ekiben542Ekiben542
提出日時 2024-03-15 21:54:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 159,064 KB
最終ジャッジ日時 2024-03-15 21:54:48
合計ジャッジ時間 6,270 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 36 ms
53,460 KB
testcase_22 AC 36 ms
53,460 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 37 ms
53,460 KB
testcase_26 AC 36 ms
53,460 KB
testcase_27 AC 36 ms
53,460 KB
testcase_28 AC 37 ms
53,460 KB
testcase_29 WA -
testcase_30 AC 188 ms
148,200 KB
testcase_31 AC 94 ms
104,944 KB
testcase_32 AC 90 ms
102,344 KB
testcase_33 AC 151 ms
125,944 KB
testcase_34 AC 212 ms
147,968 KB
testcase_35 AC 173 ms
131,496 KB
testcase_36 AC 180 ms
140,676 KB
testcase_37 AC 122 ms
106,648 KB
testcase_38 AC 212 ms
159,064 KB
testcase_39 AC 77 ms
91,420 KB
testcase_40 AC 96 ms
118,144 KB
testcase_41 AC 153 ms
124,656 KB
testcase_42 AC 115 ms
110,520 KB
testcase_43 AC 137 ms
141,604 KB
testcase_44 AC 112 ms
110,968 KB
testcase_45 AC 40 ms
59,708 KB
testcase_46 AC 46 ms
64,440 KB
testcase_47 AC 40 ms
59,708 KB
testcase_48 AC 40 ms
59,708 KB
testcase_49 AC 40 ms
59,708 KB
testcase_50 AC 46 ms
64,440 KB
testcase_51 AC 47 ms
64,440 KB
testcase_52 AC 46 ms
64,440 KB
testcase_53 AC 46 ms
64,440 KB
testcase_54 AC 47 ms
64,440 KB
testcase_55 AC 40 ms
59,708 KB
testcase_56 AC 47 ms
62,356 KB
testcase_57 AC 47 ms
62,368 KB
testcase_58 AC 38 ms
53,460 KB
testcase_59 AC 40 ms
59,708 KB
testcase_60 AC 42 ms
59,708 KB
testcase_61 AC 47 ms
62,368 KB
testcase_62 AC 46 ms
62,368 KB
testcase_63 AC 46 ms
62,352 KB
testcase_64 AC 46 ms
62,368 KB
testcase_65 WA -
testcase_66 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    
    xor_all = 0
    for a in A:
        xor_all ^= a

    if xor_all != 0:
        print('No')
        return

    xor_cum = [0]*(N+1)
    for i in range(N):
        xor_cum[i+1] = xor_cum[i] ^ A[i]

    dp = [[0]*(xor_all+1) for _ in range(N+1)]
    dp[0][0] = 1

    for i in range(N):
        for j in range(xor_all+1):
            if dp[i][j]:
                dp[i+1][j] = 1
                if j^xor_cum[i+1] <= xor_all:
                    dp[i+1][j^xor_cum[i+1]] = 1

    if dp[N][0]:
        print('Yes')
    else:
        print('No')

solve()
0