結果
| 問題 |
No.1608 Yet Another Ants Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-16 22:05:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 602 ms / 2,000 ms |
| コード長 | 857 bytes |
| コンパイル時間 | 1,221 ms |
| コンパイル使用メモリ | 82,396 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 09:19:25 |
| 合計ジャッジ時間 | 11,987 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
10 | main()
| ^~~~
ソースコード
#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;
}