結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,460 KB
testcase_01 AC 43 ms
53,460 KB
testcase_02 AC 42 ms
53,460 KB
testcase_03 AC 42 ms
53,460 KB
testcase_04 AC 43 ms
53,460 KB
testcase_05 AC 42 ms
53,460 KB
testcase_06 AC 44 ms
53,460 KB
testcase_07 AC 42 ms
53,460 KB
testcase_08 AC 42 ms
53,460 KB
testcase_09 AC 41 ms
53,460 KB
testcase_10 AC 41 ms
53,460 KB
testcase_11 AC 43 ms
53,460 KB
testcase_12 AC 42 ms
53,460 KB
testcase_13 AC 43 ms
53,460 KB
testcase_14 AC 43 ms
53,460 KB
testcase_15 AC 42 ms
53,460 KB
testcase_16 AC 43 ms
53,460 KB
testcase_17 AC 41 ms
53,460 KB
testcase_18 AC 42 ms
53,460 KB
testcase_19 AC 42 ms
53,460 KB
testcase_20 AC 43 ms
53,460 KB
testcase_21 AC 43 ms
53,460 KB
testcase_22 AC 43 ms
53,460 KB
testcase_23 AC 42 ms
53,460 KB
testcase_24 AC 42 ms
53,460 KB
testcase_25 AC 43 ms
55,608 KB
testcase_26 AC 43 ms
55,608 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 43 ms
53,460 KB
testcase_30 AC 310 ms
174,512 KB
testcase_31 AC 148 ms
115,244 KB
testcase_32 AC 132 ms
109,692 KB
testcase_33 AC 223 ms
138,944 KB
testcase_34 AC 278 ms
173,980 KB
testcase_35 AC 244 ms
148,416 KB
testcase_36 AC 295 ms
163,024 KB
testcase_37 AC 154 ms
107,540 KB
testcase_38 AC 298 ms
187,324 KB
testcase_39 AC 95 ms
89,500 KB
testcase_40 AC 152 ms
120,016 KB
testcase_41 AC 209 ms
127,904 KB
testcase_42 AC 208 ms
114,388 KB
testcase_43 AC 247 ms
146,508 KB
testcase_44 AC 176 ms
112,564 KB
testcase_45 AC 49 ms
62,084 KB
testcase_46 AC 57 ms
66,636 KB
testcase_47 AC 49 ms
62,084 KB
testcase_48 AC 49 ms
62,084 KB
testcase_49 AC 49 ms
62,084 KB
testcase_50 AC 57 ms
66,644 KB
testcase_51 AC 57 ms
66,640 KB
testcase_52 AC 57 ms
66,640 KB
testcase_53 AC 58 ms
66,640 KB
testcase_54 AC 57 ms
66,648 KB
testcase_55 AC 50 ms
62,084 KB
testcase_56 AC 58 ms
66,652 KB
testcase_57 AC 55 ms
64,456 KB
testcase_58 AC 42 ms
55,604 KB
testcase_59 AC 48 ms
62,088 KB
testcase_60 AC 47 ms
62,096 KB
testcase_61 AC 55 ms
64,580 KB
testcase_62 AC 59 ms
64,580 KB
testcase_63 AC 60 ms
66,652 KB
testcase_64 AC 54 ms
64,580 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:
    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