CODE FESTIVAL 2016 Final

Submission #1747900

Source codeソースコード

#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,m,a[nmax],i,j,ans,nr,l;
vector<int>v[nmax];
int main()
{
    //freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>m;
    for(i=1;i<=n;i++)cin>>a[i],v[a[i]%m].pb(a[i]);
    ans+=v[0].size()/2;
    if(m%2==0)ans+=v[m/2].size()/2;
    for(i=1;i<=(m-1)/2;i++)sort(v[i].begin(),v[i].end());
    for(i=1;i<=(m-1)/2;i++)
	{
		if(v[i].size()<v[m-i].size())swap(v[i],v[m-i]);
		nr=v[i].size(),l=-1;
		for(j=1;j<v[i].size();j++)if(v[i][j]==v[i][j-1] && l!=j-1 && nr-2>=v[m-i].size())nr-=2,ans++,l=j;
		ans+=v[m-i].size();
	}
	cout<<ans<<endl;
	return 0;
}

Submission

Task問題 D - Pair Cards
User nameユーザ名 InfoAdict
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1045 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
all 0 / 700 sample-01.txt,sample-02.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,01-20.txt,01-21.txt,01-22.txt,01-23.txt,01-24.txt,01-25.txt,01-26.txt,01-27.txt,01-28.txt,01-29.txt,01-30.txt,sample-01.txt,sample-02.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 3 ms 2560 KB
01-02.txt AC 12 ms 3576 KB
01-03.txt AC 11 ms 3580 KB
01-04.txt WA
01-05.txt AC 13 ms 3584 KB
01-06.txt WA
01-07.txt WA
01-08.txt WA
01-09.txt WA
01-10.txt WA
01-11.txt AC 21 ms 4992 KB
01-12.txt AC 13 ms 3576 KB
01-13.txt AC 13 ms 3576 KB
01-14.txt AC 12 ms 3472 KB
01-15.txt AC 14 ms 3712 KB
01-16.txt AC 14 ms 3712 KB
01-17.txt AC 14 ms 3584 KB
01-18.txt AC 16 ms 3840 KB
01-19.txt AC 17 ms 3712 KB
01-20.txt AC 19 ms 6144 KB
01-21.txt AC 12 ms 3520 KB
01-22.txt WA
01-23.txt WA
01-24.txt WA
01-25.txt WA
01-26.txt AC 16 ms 3712 KB
01-27.txt AC 11 ms 4352 KB
01-28.txt AC 4 ms 2688 KB
01-29.txt AC 3 ms 2688 KB
01-30.txt AC 3 ms 2560 KB
sample-01.txt AC 3 ms 2560 KB
sample-02.txt AC 3 ms 2560 KB