結果

問題 No.2672 Subset Xor Sum
ユーザー FromBooskaFromBooska
提出日時 2024-03-16 07:32:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,001 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 187,304 KB
最終ジャッジ日時 2024-03-16 07:32:38
合計ジャッジ時間 8,217 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 40 ms
53,460 KB
testcase_03 AC 41 ms
53,460 KB
testcase_04 AC 40 ms
53,460 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 40 ms
53,460 KB
testcase_08 AC 40 ms
53,460 KB
testcase_09 AC 40 ms
53,460 KB
testcase_10 AC 40 ms
53,460 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 41 ms
53,460 KB
testcase_13 AC 41 ms
53,460 KB
testcase_14 AC 41 ms
53,460 KB
testcase_15 AC 41 ms
53,460 KB
testcase_16 AC 41 ms
53,460 KB
testcase_17 AC 41 ms
53,460 KB
testcase_18 AC 41 ms
53,460 KB
testcase_19 AC 42 ms
53,460 KB
testcase_20 AC 41 ms
53,460 KB
testcase_21 AC 41 ms
53,460 KB
testcase_22 AC 41 ms
53,460 KB
testcase_23 AC 41 ms
53,460 KB
testcase_24 AC 40 ms
53,460 KB
testcase_25 AC 41 ms
55,608 KB
testcase_26 AC 42 ms
55,608 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 41 ms
53,460 KB
testcase_30 AC 275 ms
174,616 KB
testcase_31 AC 138 ms
115,244 KB
testcase_32 AC 126 ms
109,692 KB
testcase_33 AC 210 ms
138,928 KB
testcase_34 AC 289 ms
173,964 KB
testcase_35 AC 235 ms
148,404 KB
testcase_36 AC 255 ms
163,012 KB
testcase_37 AC 148 ms
107,540 KB
testcase_38 AC 292 ms
187,304 KB
testcase_39 AC 89 ms
89,500 KB
testcase_40 AC 145 ms
119,908 KB
testcase_41 AC 200 ms
127,896 KB
testcase_42 AC 173 ms
114,408 KB
testcase_43 AC 228 ms
146,492 KB
testcase_44 AC 169 ms
112,528 KB
testcase_45 AC 48 ms
62,084 KB
testcase_46 AC 56 ms
66,644 KB
testcase_47 AC 45 ms
62,084 KB
testcase_48 AC 46 ms
62,084 KB
testcase_49 AC 47 ms
62,084 KB
testcase_50 AC 55 ms
66,652 KB
testcase_51 AC 55 ms
66,648 KB
testcase_52 AC 55 ms
66,648 KB
testcase_53 AC 55 ms
66,648 KB
testcase_54 AC 55 ms
66,652 KB
testcase_55 AC 46 ms
62,084 KB
testcase_56 AC 53 ms
66,660 KB
testcase_57 AC 51 ms
64,464 KB
testcase_58 AC 40 ms
55,600 KB
testcase_59 AC 45 ms
62,088 KB
testcase_60 AC 46 ms
62,096 KB
testcase_61 AC 54 ms
64,584 KB
testcase_62 AC 55 ms
64,584 KB
testcase_63 AC 59 ms
66,660 KB
testcase_64 AC 54 ms
64,588 KB
testcase_65 AC 41 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'
    if N>5001:
        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