Submission #6001253
Source Code Expand
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<queue>
#include<list>
#include<stack>
#include<deque>
#include <sstream>
#include <string.h>
#include<fstream>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"490
void fo (){fflush(stdout);}
using namespace std;
map <int,int> a , b;
int main ()
{
int n ;
scanf ("%d" , &n );
int frq1 , frq2 ;
frq1 = frq2 = 0 ;
for (int i =0 ,t , turn = 0 ;i < n ;i++ , turn = !turn )
{
scanf ("%d" ,&t );
if (turn)
{
a[t]++;
frq1 = max (frq1 , a[t]);
}else
{
b[t]++;
frq2 = max (frq2 , b[t]);
}
}
int ans = 0 ;
if (SZ(a) == SZ(b) && SZ(a) == 1 )
{
if (*a.begin() == *b.begin())
ans = n/2;
}else
{
ans = n - frq1 - frq2 ;
}
printf ("%d\n" ,ans );
return 0;
}
Submission Info
Submission Time |
|
Task |
C - /\/\/\/ |
User |
MohamedSameh |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1111 Byte |
Status |
WA |
Exec Time |
52 ms |
Memory |
4992 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:31:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d" , &n );
^
./Main.cpp:36:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf ("%d" ,&t );
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
30 ms |
2560 KB |
ababa_1.txt |
AC |
29 ms |
2560 KB |
eq_0.txt |
AC |
11 ms |
256 KB |
eq_1.txt |
AC |
11 ms |
256 KB |
rnd_17.txt |
AC |
11 ms |
256 KB |
sample1_3132.txt |
AC |
1 ms |
256 KB |
sample2_iw.txt |
AC |
2 ms |
256 KB |
sample3_1111.txt |
AC |
1 ms |
256 KB |
top2_0.txt |
AC |
19 ms |
512 KB |
top2_1.txt |
AC |
19 ms |
512 KB |
top2_2.txt |
WA |
19 ms |
512 KB |
top2_3.txt |
WA |
19 ms |
512 KB |
top2modoki_0.txt |
AC |
19 ms |
512 KB |
top2modoki_1.txt |
AC |
19 ms |
512 KB |
top2modoki_2.txt |
AC |
19 ms |
512 KB |
top2modoki_3.txt |
AC |
19 ms |
512 KB |
vary_1.txt |
AC |
52 ms |
4992 KB |
vary_2.txt |
AC |
47 ms |
4864 KB |
vary_3.txt |
AC |
39 ms |
3328 KB |
zoro_0.txt |
AC |
1 ms |
256 KB |