結果

問題 No.2672 Subset Xor Sum
ユーザー hato336hato336
提出日時 2024-03-15 21:46:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,501 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 406,256 KB
最終ジャッジ日時 2024-03-16 17:40:57
合計ジャッジ時間 20,805 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
89,144 KB
testcase_01 AC 139 ms
89,144 KB
testcase_02 AC 145 ms
89,144 KB
testcase_03 AC 141 ms
89,144 KB
testcase_04 AC 142 ms
89,144 KB
testcase_05 AC 142 ms
89,144 KB
testcase_06 AC 142 ms
89,144 KB
testcase_07 AC 142 ms
89,144 KB
testcase_08 AC 139 ms
89,144 KB
testcase_09 AC 142 ms
89,144 KB
testcase_10 AC 138 ms
89,144 KB
testcase_11 AC 144 ms
89,144 KB
testcase_12 AC 137 ms
89,144 KB
testcase_13 AC 137 ms
89,144 KB
testcase_14 AC 147 ms
89,144 KB
testcase_15 AC 138 ms
89,144 KB
testcase_16 AC 137 ms
89,144 KB
testcase_17 AC 139 ms
89,144 KB
testcase_18 AC 144 ms
89,144 KB
testcase_19 AC 142 ms
89,144 KB
testcase_20 AC 139 ms
89,144 KB
testcase_21 AC 138 ms
89,144 KB
testcase_22 AC 140 ms
89,144 KB
testcase_23 AC 138 ms
89,144 KB
testcase_24 AC 141 ms
89,144 KB
testcase_25 AC 143 ms
89,144 KB
testcase_26 AC 127 ms
84,920 KB
testcase_27 AC 124 ms
84,920 KB
testcase_28 AC 142 ms
89,144 KB
testcase_29 AC 141 ms
89,144 KB
testcase_30 AC 149 ms
89,144 KB
testcase_31 AC 228 ms
156,732 KB
testcase_32 AC 175 ms
113,720 KB
testcase_33 AC 169 ms
110,520 KB
testcase_34 AC 203 ms
135,864 KB
testcase_35 AC 222 ms
156,704 KB
testcase_36 AC 206 ms
142,200 KB
testcase_37 AC 211 ms
149,376 KB
testcase_38 AC 178 ms
117,304 KB
testcase_39 AC 242 ms
146,320 KB
testcase_40 AC 156 ms
98,360 KB
testcase_41 AC 185 ms
130,076 KB
testcase_42 AC 197 ms
149,160 KB
testcase_43 AC 187 ms
135,864 KB
testcase_44 AC 224 ms
149,716 KB
testcase_45 AC 189 ms
135,480 KB
testcase_46 AC 133 ms
88,760 KB
testcase_47 AC 1,501 ms
405,944 KB
testcase_48 AC 135 ms
88,760 KB
testcase_49 AC 133 ms
88,760 KB
testcase_50 AC 136 ms
88,760 KB
testcase_51 AC 1,487 ms
406,256 KB
testcase_52 AC 140 ms
89,400 KB
testcase_53 AC 140 ms
89,144 KB
testcase_54 AC 1,488 ms
405,996 KB
testcase_55 AC 1,484 ms
406,000 KB
testcase_56 AC 135 ms
88,760 KB
testcase_57 AC 1,023 ms
310,328 KB
testcase_58 AC 438 ms
154,808 KB
testcase_59 AC 123 ms
84,920 KB
testcase_60 AC 137 ms
88,760 KB
testcase_61 AC 136 ms
88,760 KB
testcase_62 AC 707 ms
222,136 KB
testcase_63 AC 830 ms
244,920 KB
testcase_64 AC 137 ms
89,272 KB
testcase_65 AC 465 ms
154,808 KB
testcase_66 AC 138 ms
89,016 KB
testcase_67 AC 125 ms
84,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
if functools.reduce(operator.xor,a) != 0:
    print('No')
    exit()

c = collections.Counter(a)
for i in a:
    if c[i] >= 2 and n >= 3:
        print('Yes')
        exit()

dp = [[0 for i in range(8192)] for j in range(n+1)]
dp[1][a[0]] = 1
for i in range(n):
    for j in range(8192):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j ^ a[i]] += dp[i][j]
        dp[i+1][j] = min(dp[i+1][j],2)
        dp[i+1][j ^ a[i]] = min(dp[i+1][j ^ a[i]],2)
print('Yes' if dp[-1][0] >= 2 else 'No')
0