結果
| 問題 |
No.2575 Almost Increasing Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-08 23:11:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 10,000 ms |
| コード長 | 1,142 bytes |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 168,412 KB |
| 実行使用メモリ | 8,276 KB |
| スコア | 200 |
| 最終ジャッジ日時 | 2023-12-08 23:11:39 |
| 合計ジャッジ時間 | 2,962 ms |
|
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int p=998244353;
const int maxn=2e5+5;
int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*u)%p;} else {int u=po(a,b-1);return (a*u)%p;}}
int inv(int x) {return po(x,p-2);}
int fact[maxn];int invf[maxn];int invm[maxn];
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
fact[0]=1;for(int i=1;i<maxn;++i) {fact[i]=(fact[i-1]*i)%p;} invf[maxn-1]=inv(fact[maxn-1]);for(int i=maxn-2;i>=0;--i) {invf[i]=(invf[i+1]*(i+1))%p;}
for(int i=1;i<maxn;++i) {invm[i]=(invf[i]*fact[i-1])%p;}
int k;cin>>k;
int n=10;
int res[901]={0};
for(int a=1;a<=n;++a)
{
int pok=po(a,k);
for(int b=1;b<=a;++b)
{
for(int c=1;c<=b;++c)
{
int ways=((((((((((invf[c]*invf[b+1])%p)*(b-c+1)%p)*invf[a+2])%p)*(a-c+2))%p)*(a-b+1))%p)*fact[a+b+c])%p;
res[a+b+c]+=pok*((ways*ways)%p);res[a+b+c]%=p;
}
}
}
cout<<n<<'\n';
for(int i=1;i<=n;++i) {cout<<res[i];if(i!=n) cout<<' ';}
return 0;
}