Submission #7573101


Source Code Expand

Copy
#D問題
N = int(input())
A = list(map(int,input().split()))

srui = [0]
xrui = [0]

for a in A:
    srui.append(srui[-1]+a)
    xrui.append(xrui[-1]^a)
    
#print(srui,xrui)
ans = 0
J = 1
for i in range(N):
    I = i+1
    while J <= N and (srui[J]-srui[I-1]) == (xrui[J]^xrui[I-1]):
        J+=1
    J-=1
    ans += J-I+1
            
print(ans)

Submission Info

Submission Time
Task D - Xor Sum 2
User OribeYasuna
Language PyPy3 (2.4.0)
Score 500
Code Size 369 Byte
Status
Exec Time 272 ms
Memory 100428 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 500 / 500 sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt, subtask_1_30.txt, subtask_1_31.txt, subtask_1_32.txt
Case Name Status Exec Time Memory
sample_01.txt 160 ms 38256 KB
sample_02.txt 164 ms 38256 KB
sample_03.txt 163 ms 38256 KB
subtask_1_01.txt 160 ms 38256 KB
subtask_1_02.txt 163 ms 38256 KB
subtask_1_03.txt 223 ms 71068 KB
subtask_1_04.txt 175 ms 39664 KB
subtask_1_05.txt 218 ms 61960 KB
subtask_1_06.txt 208 ms 53484 KB
subtask_1_07.txt 173 ms 39664 KB
subtask_1_08.txt 210 ms 54908 KB
subtask_1_09.txt 223 ms 64892 KB
subtask_1_10.txt 236 ms 71016 KB
subtask_1_11.txt 235 ms 74548 KB
subtask_1_12.txt 272 ms 86632 KB
subtask_1_13.txt 199 ms 50820 KB
subtask_1_14.txt 190 ms 46064 KB
subtask_1_15.txt 210 ms 54076 KB
subtask_1_16.txt 176 ms 39664 KB
subtask_1_17.txt 234 ms 83932 KB
subtask_1_18.txt 240 ms 83932 KB
subtask_1_19.txt 248 ms 84984 KB
subtask_1_20.txt 267 ms 100428 KB
subtask_1_21.txt 250 ms 84672 KB
subtask_1_22.txt 262 ms 90120 KB
subtask_1_23.txt 250 ms 84256 KB
subtask_1_24.txt 262 ms 88924 KB
subtask_1_25.txt 250 ms 84952 KB
subtask_1_26.txt 269 ms 95308 KB
subtask_1_27.txt 242 ms 83292 KB
subtask_1_28.txt 242 ms 83932 KB
subtask_1_29.txt 246 ms 83932 KB
subtask_1_30.txt 245 ms 83932 KB
subtask_1_31.txt 245 ms 83932 KB
subtask_1_32.txt 246 ms 83928 KB