結果

問題 No.2672 Subset Xor Sum
ユーザー FromBooskaFromBooska
提出日時 2024-03-15 23:14:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 187,316 KB
最終ジャッジ日時 2024-03-15 23:14:52
合計ジャッジ時間 7,839 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 41 ms
53,460 KB
testcase_03 AC 41 ms
53,460 KB
testcase_04 AC 40 ms
53,460 KB
testcase_05 AC 41 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 41 ms
53,460 KB
testcase_08 AC 44 ms
53,460 KB
testcase_09 AC 42 ms
53,460 KB
testcase_10 AC 40 ms
53,460 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 40 ms
53,460 KB
testcase_13 AC 40 ms
53,460 KB
testcase_14 AC 40 ms
53,460 KB
testcase_15 AC 40 ms
53,460 KB
testcase_16 AC 40 ms
53,460 KB
testcase_17 AC 40 ms
53,460 KB
testcase_18 AC 39 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 43 ms
53,460 KB
testcase_22 AC 41 ms
53,460 KB
testcase_23 AC 41 ms
53,460 KB
testcase_24 AC 41 ms
53,460 KB
testcase_25 AC 41 ms
55,608 KB
testcase_26 AC 41 ms
55,608 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 40 ms
53,460 KB
testcase_30 AC 303 ms
174,624 KB
testcase_31 AC 141 ms
115,244 KB
testcase_32 AC 129 ms
109,692 KB
testcase_33 AC 219 ms
138,952 KB
testcase_34 AC 276 ms
173,972 KB
testcase_35 AC 271 ms
148,408 KB
testcase_36 AC 262 ms
163,020 KB
testcase_37 AC 154 ms
107,540 KB
testcase_38 AC 295 ms
187,316 KB
testcase_39 AC 91 ms
89,500 KB
testcase_40 AC 151 ms
119,900 KB
testcase_41 AC 231 ms
127,900 KB
testcase_42 AC 178 ms
114,404 KB
testcase_43 AC 232 ms
146,500 KB
testcase_44 AC 183 ms
112,524 KB
testcase_45 AC 50 ms
62,084 KB
testcase_46 AC 57 ms
66,640 KB
testcase_47 AC 46 ms
62,084 KB
testcase_48 AC 46 ms
62,084 KB
testcase_49 AC 46 ms
62,084 KB
testcase_50 AC 55 ms
66,648 KB
testcase_51 AC 55 ms
66,644 KB
testcase_52 AC 54 ms
66,644 KB
testcase_53 AC 59 ms
66,644 KB
testcase_54 AC 54 ms
66,648 KB
testcase_55 AC 46 ms
62,084 KB
testcase_56 AC 56 ms
66,656 KB
testcase_57 AC 51 ms
64,460 KB
testcase_58 AC 40 ms
55,604 KB
testcase_59 AC 46 ms
62,088 KB
testcase_60 AC 45 ms
62,096 KB
testcase_61 AC 53 ms
64,580 KB
testcase_62 AC 54 ms
64,580 KB
testcase_63 AC 57 ms
66,656 KB
testcase_64 AC 52 ms
64,584 KB
testcase_65 AC 40 ms
53,460 KB
testcase_66 AC 41 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# まず全部で0になるか、そしてどこかで0ができればYesだろう
# どこかで0になるかは、定かでないがソートして累積xor sumして同じ数字がN差でなく登場するかでどうだろう


N = int(input())
A = list(map(int, input().split()))
A.sort()

from collections import Counter, defaultdict

total = 0
for i in range(N):
    total ^= A[i]
#print('total', total)
ans = 'No'
if total == 0:
    if 0 in A:
        ans = 'Yes'
    
    xor_cumu = [0]
    temp = 0
    for a in A:
        temp ^= a
        xor_cumu.append(temp)
    dic = defaultdict(list)
    for i in range(N, -1, -1):
        dic[xor_cumu[i]].append(i)
    #print('xor_cumu', xor_cumu)
    #print('dic', dic)
    
    for i in range(N+1):
        #print('i', i, 'dic[xor_cumu[i]][0]', dic[xor_cumu[i]][0], dic[xor_cumu[i]][0]-i<N, 'ans', ans)
        if dic[xor_cumu[i]][0] != i and dic[xor_cumu[i]][0]-i<N: 
            ans = 'Yes'
        
print(ans)
0