Submission #22134936
Source Code Expand
import collections
N = int(input())
V = list(map(int, input().split()))
F = []
S = []
for i in range(N):
if i%2==0:
F.append(V[i])
else:
S.append(V[i])
FMC = collections.Counter(F).most_common()
SMC = collections.Counter(S).most_common()
if FMC[0][0] == SMC[0][0]:
#一番多い種類が同じ場合は、どちらかは(存在すれば)2番目に多い種類にする
#変更しないですむ値をカウント
fnc = 0
snc = 0
if len(FMC)>1:
fnc = FMC[1][1]
if len(SMC)>1:
snc = SMC[1][1]
print(min(N-fnc-SMC[0][1],N-FMC[0][1]-snc))
else:
print(N-FMC[0][1]-SMC[0][1])
Submission Info
| Submission Time | |
|---|---|
| Task | C - /\/\/\/ |
| User | H20 |
| Language | PyPy3 (7.3.0) |
| Score | 300 |
| Code Size | 671 Byte |
| Status | AC |
| Exec Time | 142 ms |
| Memory | 91460 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample1_3132.txt, sample2_iw.txt, sample3_1111.txt |
| All | 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 | AC | 142 ms | 91132 KiB |
| ababa_1.txt | AC | 114 ms | 90884 KiB |
| eq_0.txt | AC | 91 ms | 81916 KiB |
| eq_1.txt | AC | 89 ms | 81628 KiB |
| rnd_17.txt | AC | 89 ms | 82436 KiB |
| sample1_3132.txt | AC | 55 ms | 64780 KiB |
| sample2_iw.txt | AC | 60 ms | 64968 KiB |
| sample3_1111.txt | AC | 56 ms | 64956 KiB |
| top2_0.txt | AC | 96 ms | 81776 KiB |
| top2_1.txt | AC | 98 ms | 82096 KiB |
| top2_2.txt | AC | 97 ms | 82204 KiB |
| top2_3.txt | AC | 98 ms | 81608 KiB |
| top2modoki_0.txt | AC | 96 ms | 81860 KiB |
| top2modoki_1.txt | AC | 97 ms | 82124 KiB |
| top2modoki_2.txt | AC | 97 ms | 81580 KiB |
| top2modoki_3.txt | AC | 95 ms | 81608 KiB |
| vary_1.txt | AC | 133 ms | 91460 KiB |
| vary_2.txt | AC | 129 ms | 91092 KiB |
| vary_3.txt | AC | 124 ms | 86388 KiB |
| zoro_0.txt | AC | 57 ms | 64808 KiB |