結果

問題 No.287 場合の数
ユーザー kotatsugame
提出日時 2020-02-27 20:37:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 705 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 77,516 KB
実行使用メモリ 9,312 KB
最終ジャッジ日時 2024-10-13 16:00:47
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
main()
{
	int N;cin>>N;
	vector<pair<int,long> >A;
	for(int i=0;i<=N;i++)A.push_back(make_pair(i,1L));
	for(int ccc=0;ccc<3;ccc++)
	{
		vector<pair<int,long> >B;
		for(int i=0;i<A.size();i++)for(int j=0;j<A.size();j++)
		{
			B.push_back(make_pair(A[i].first+A[j].first,A[i].second*A[j].second));
		}
		sort(B.begin(),B.end());
		long t=0;
		int pre=0;
		A.clear();
		for(pair<int,long>p:B)
		{
			if(pre<p.first)
			{
				A.push_back(make_pair(pre,t));
				t=0;
				pre=p.first;
			}
			t+=p.second;
		}
		A.push_back(make_pair(pre,t));
	}
	long ans=0;
	for(pair<int,long>p:A)if(p.first==6*N)ans+=p.second;
	cout<<ans<<endl;
}
0