Submission #7153177


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define max(p,q)((p)>(q)?(p):(q))
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll a[100010];
ll b[100010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		if(i%2)b[t]+=2e5;
		else a[t]+=2e5;
	}
	for(int i=0;i<100005;i++){
		a[i]+=i;
		b[i]+=i;
	}
	sortdown(a,100003);
	sortdown(b,100003);
	if(a[0]%200000!=b[0]%200000){
		printf("%d",n-a[0]/200000-b[0]/200000);
	}else{
		int a1=a[1]/200000,b1=b[1]/200000;
		printf("%d",n-a[0]/200000-max(a1,b1));
	}
}

Submission Info

Submission Time
Task C - /\/\/\/
User kyopro_friends
Language C (GCC 5.4.1)
Score 300
Code Size 684 Byte
Status AC
Exec Time 28 ms
Memory 2556 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:26:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   printf("%d",n-a[0]/200000-b[0]/200000);
          ^
./Main.c:29:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   printf("%d",n-a[0]/200000-max(a1,b1));
          ^
./Main.c:12:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ^
./Main.c:15:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&t);
   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
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 24 ms 2556 KB
ababa_1.txt AC 24 ms 2556 KB
eq_0.txt AC 22 ms 2556 KB
eq_1.txt AC 22 ms 2556 KB
rnd_17.txt AC 22 ms 2556 KB
sample1_3132.txt AC 12 ms 2556 KB
sample2_iw.txt AC 12 ms 2556 KB
sample3_1111.txt AC 12 ms 2556 KB
top2_0.txt AC 23 ms 2556 KB
top2_1.txt AC 23 ms 2556 KB
top2_2.txt AC 23 ms 2556 KB
top2_3.txt AC 23 ms 2556 KB
top2modoki_0.txt AC 23 ms 2556 KB
top2modoki_1.txt AC 23 ms 2556 KB
top2modoki_2.txt AC 23 ms 2556 KB
top2modoki_3.txt AC 23 ms 2556 KB
vary_1.txt AC 26 ms 2556 KB
vary_2.txt AC 28 ms 2556 KB
vary_3.txt AC 25 ms 2556 KB
zoro_0.txt AC 12 ms 2556 KB