Submission #73537143


Source Code Expand

"""

1 | 1 2 | 2 3 | 3

"""

TT = int(input())

for loop in range(TT):

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

    dic = {}
    B = []
    last = 0
    
    for i in range(2*N):
        if A[i] not in dic:
            B.append(last)
            dic[A[i]] = last
        else:
            B.append( dic[A[i]]^1 )

        last = B[-1]

    ans = []

    for i in range(2*N-1):
        if B[i] != B[i+1]:
            ans.append(i+1)

    print (len(ans))
    print (*ans)

Submission Info

Submission Time
Task B - Stolen Necklace
User SPD_9X2
Language Python (PyPy 3.11-v7.3.20)
Score 500
Code Size 528 Byte
Status AC
Exec Time 480 ms
Memory 236272 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 1
AC × 20
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, hand-14.txt, hand-15.txt, hand-16.txt, hand-17.txt, max-12.txt, min-13.txt, nyaan_killer-19.txt, random-01.txt, random-02.txt, random-03.txt, random-04.txt, random-05.txt, random-06.txt, random-07.txt, random-08.txt, random-09.txt, random-10.txt, random-11.txt, random-18.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 48 ms 79900 KiB
hand-14.txt AC 263 ms 236272 KiB
hand-15.txt AC 255 ms 234596 KiB
hand-16.txt AC 227 ms 229816 KiB
hand-17.txt AC 231 ms 229964 KiB
max-12.txt AC 258 ms 236204 KiB
min-13.txt AC 140 ms 212476 KiB
nyaan_killer-19.txt AC 223 ms 229796 KiB
random-01.txt AC 480 ms 172352 KiB
random-02.txt AC 195 ms 109304 KiB
random-03.txt AC 154 ms 110204 KiB
random-04.txt AC 168 ms 137240 KiB
random-05.txt AC 186 ms 153800 KiB
random-06.txt AC 208 ms 182588 KiB
random-07.txt AC 226 ms 225584 KiB
random-08.txt AC 225 ms 225552 KiB
random-09.txt AC 224 ms 225612 KiB
random-10.txt AC 224 ms 225436 KiB
random-11.txt AC 225 ms 225644 KiB
random-18.txt AC 170 ms 109544 KiB