Submission #3501581
Source Code Expand
#include <stdio.h> int main() { int n,i,par[100002],impar[100002],a; for (i=1; i<=100001; i++) { par[i]=0; impar[i]=0; } scanf ("%d",&n); for (i=1; i<=n; i++) { scanf ("%d",&a); if (i%2==1) { impar[a]++; } else { par[a]++; } } int maxpar=0,maxpar2=0,maximpar=0,maximpar2=0; int valpar,valimpar; for (i=1; i<=100001; i++) { if (impar[i]>maximpar) { maximpar2=maximpar; maximpar=impar[i]; valimpar=i; } else if (impar[i]>maximpar2) { maximpar2=impar[i]; } if (par[i]>maxpar) { maxpar2=maxpar; maxpar=par[i]; valpar=i; } else if (par[i]>maxpar2) { maxpar2=par[i]; } } if (valpar==valimpar) { if (maxpar2>maximpar2) { printf ("%d\n",n-maxpar2-maximpar); } else { printf ("%d\n",n-maxpar-maximpar2); } } else { printf ("%d\n",n-maxpar-maximpar); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - /\/\/\/ |
User | Andrei501 |
Language | C (GCC 5.4.1) |
Score | 300 |
Code Size | 1283 Byte |
Status | AC |
Exec Time | 11 ms |
Memory | 896 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:13:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%d",&n); ^ ./Main.c:17:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%d",&a); ^
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 | 11 ms | 896 KB |
ababa_1.txt | AC | 11 ms | 896 KB |
eq_0.txt | AC | 11 ms | 896 KB |
eq_1.txt | AC | 11 ms | 896 KB |
rnd_17.txt | AC | 11 ms | 896 KB |
sample1_3132.txt | AC | 1 ms | 896 KB |
sample2_iw.txt | AC | 1 ms | 896 KB |
sample3_1111.txt | AC | 1 ms | 896 KB |
top2_0.txt | AC | 11 ms | 896 KB |
top2_1.txt | AC | 11 ms | 896 KB |
top2_2.txt | AC | 11 ms | 896 KB |
top2_3.txt | AC | 11 ms | 896 KB |
top2modoki_0.txt | AC | 11 ms | 896 KB |
top2modoki_1.txt | AC | 11 ms | 896 KB |
top2modoki_2.txt | AC | 11 ms | 896 KB |
top2modoki_3.txt | AC | 11 ms | 896 KB |
vary_1.txt | AC | 11 ms | 896 KB |
vary_2.txt | AC | 11 ms | 896 KB |
vary_3.txt | AC | 11 ms | 896 KB |
zoro_0.txt | AC | 1 ms | 896 KB |