結果

問題 No.1608 Yet Another Ants Problem
ユーザー kotatsugamekotatsugame
提出日時 2021-07-16 22:05:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 639 ms / 2,000 ms
コード長 857 bytes
コンパイル時間 1,025 ms
コンパイル使用メモリ 80,964 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 14:06:04
合計ジャッジ時間 14,674 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 636 ms
4,380 KB
testcase_15 AC 639 ms
4,380 KB
testcase_16 AC 637 ms
4,376 KB
testcase_17 AC 636 ms
4,380 KB
testcase_18 AC 636 ms
4,376 KB
testcase_19 AC 54 ms
4,376 KB
testcase_20 AC 273 ms
4,384 KB
testcase_21 AC 262 ms
4,376 KB
testcase_22 AC 172 ms
4,376 KB
testcase_23 AC 610 ms
4,380 KB
testcase_24 AC 637 ms
4,376 KB
testcase_25 AC 637 ms
4,376 KB
testcase_26 AC 636 ms
4,376 KB
testcase_27 AC 636 ms
4,376 KB
testcase_28 AC 637 ms
4,376 KB
testcase_29 AC 636 ms
4,376 KB
testcase_30 AC 636 ms
4,376 KB
testcase_31 AC 636 ms
4,380 KB
testcase_32 AC 635 ms
4,380 KB
testcase_33 AC 636 ms
4,380 KB
testcase_34 AC 636 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   10 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
#include<vector>
#include<algorithm>
using namespace std;
using mint=atcoder::modint998244353;
int N,L;
int A[3030];
mint ans[3030];
main()
{
	cin>>N>>L;
	vector<pair<pair<int,int>,int> >B;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		B.push_back(make_pair(make_pair(A[i],1),i));
		B.push_back(make_pair(make_pair(L-A[i],0),i));
	}
	sort(B.begin(),B.end());
	int l=0,r=0;
	for(int i=0;i<N;i++)
	{
		if(B[i].first.second==0)r++;
		else l++;
	}
	if(B[N-1].first.second==0)
	{
		ans[N-r]=1;
	}
	else
	{
		ans[l-1]=1;
	}
	for(int i=N;i<2*N;i++)
	{
		if(B[i].first.second==0)l--;
		else r--;
		int nc=i-N;
		mint C=1;
		for(int k=0;k<=nc;k++)
		{
			if(B[i].first.second==0)
			{
				ans[N-(r+nc-k)-1]+=C;
			}
			else
			{
				ans[l+k]+=C;
			}
			C=C*(nc-k)/(k+1);
		}
	}
	for(int i=0;i<N;i++)cout<<ans[i].val()<<endl;
}
0