Submission #3293943


Source Code Expand

Copy
import numpy as np

n=int(input())
v=list(map(int,input().split()))

e=np.array([v[i] for i in range(0,n,2)])
o=np.array([v[i] for i in range(1,n,2)])

se=set(e)
so=set(o)


if(len(se)==1 and len(so)==1):
    if(e[0]==o[0]):print(n//2)
    else:print(0)
    exit()

le=[]


for ve in se:
    a=len(e[e != ve])
    le.append([a,ve])

lo=[]
for vo in so:
    a=len(o[o != vo])
    lo.append([a,vo])
    
    
le.sort()
lo.sort()

if(len(se)==1):
    if(lo[0][1]!=le[0][1]):print(lo[0][0])
    else:print(lo[1][0])
elif(len(so)==1):
    if(lo[0][1]!=le[0][1]):print(le[0][0])
    else:print(le[1][0])
else:
    if(lo[0][1]!=le[0][1]):print(le[0][0]+lo[0][0])
    else:print(min(le[1][0]+lo[0][0],le[0][0]+lo[1][0]))

Submission Info

Submission Time
Task C - /\/\/\/
User shomu36
Language Python3 (3.4.3)
Score 0
Code Size 753 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1_3132.txt, sample2_iw.txt, sample3_1111.txt
All 0 / 300 ababa_0.txt, ababa_1.txt, eq_0.txt, eq_1.txt, rnd_17.txt, sample1_3132.txt, sample2_iw.txt, sample3_1111.txt, top2_0.txt, top2_1.txt, top2_2.txt, top2_3.txt, top2modoki_0.txt, top2modoki_1.txt, top2modoki_2.txt, top2modoki_3.txt, vary_1.txt, vary_2.txt, vary_3.txt, zoro_0.txt
Case Name Status Exec Time Memory
ababa_0.txt
ababa_1.txt
eq_0.txt 207 ms 22964 KB
eq_1.txt 207 ms 23080 KB
rnd_17.txt 208 ms 22840 KB
sample1_3132.txt 153 ms 12436 KB
sample2_iw.txt 153 ms 12524 KB
sample3_1111.txt 152 ms 12396 KB
top2_0.txt 1240 ms 22944 KB
top2_1.txt 1250 ms 22916 KB
top2_2.txt 1238 ms 22828 KB
top2_3.txt 1235 ms 22964 KB
top2modoki_0.txt 1251 ms 22940 KB
top2modoki_1.txt 1266 ms 23056 KB
top2modoki_2.txt 1241 ms 22956 KB
top2modoki_3.txt 1229 ms 22908 KB
vary_1.txt
vary_2.txt
vary_3.txt
zoro_0.txt 148 ms 12436 KB