Submission #1082207


Source Code Expand

#include <bits/stdc++.h>
#define MAX 2005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<ll,ll>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);
#define INT_SIZE 32
using namespace std;

ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int arr[MAX],n;
int ans[MAX][MAX];
int msis[MAX][MAX],msis2[MAX][MAX];
int pre[MAX];
int len[MAX][MAX];
void maxSumIS(int x)
{
    int i, j, max = 0;

    for ( i = x; i < n; i++ )
        msis[x][i] = arr[i];
    for ( i = x+1; i < n; i++ )
        for ( j = x; j < i; j++ )
            if ( arr[i] > arr[j] && msis[x][i] < msis[x][j] + arr[i])
                msis[x][i] = msis[x][j] + arr[i];

    for ( i = x; i < n; i++ )
    {
    	ans[x][i]=ans[x][i-1];
        if ( ans[x][i] < msis[x][i] )
            ans[x][i] = msis[x][i];
    }
}
int val[1000000];
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        val[x]++;
    }
    for(int i=0;i<=100000;i++)
    {

        if(val[i]>1)
        {
            ans+=val[i];
            ans--;
        }
    }
    if(ans&1)
        ans++;
    cout<<n-ans<<endl;
}

Submission Info

Submission Time
Task D - Card Eater
User namelessmonster
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1933 Byte
Status AC
Exec Time 35 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 17
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 3 ms 256 KB
00_example_02.txt AC 3 ms 256 KB
01.txt AC 3 ms 256 KB
02.txt AC 5 ms 256 KB
03.txt AC 3 ms 512 KB
04.txt AC 3 ms 384 KB
05.txt AC 3 ms 512 KB
06.txt AC 35 ms 512 KB
07.txt AC 35 ms 512 KB
08.txt AC 35 ms 640 KB
09.txt AC 34 ms 384 KB
10.txt AC 35 ms 256 KB
11.txt AC 35 ms 640 KB
12.txt AC 34 ms 512 KB
13.txt AC 35 ms 640 KB
14.txt AC 35 ms 640 KB
15.txt AC 35 ms 256 KB