結果
問題 |
No.2575 Almost Increasing Sequence
|
ユーザー |
|
提出日時 | 2023-12-09 00:16:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,858 bytes |
コンパイル時間 | 3,438 ms |
コンパイル使用メモリ | 169,568 KB |
実行使用メモリ | 12,896 KB |
スコア | 300,000 |
最終ジャッジ日時 | 2023-12-09 00:18:30 |
合計ジャッジ時間 | 24,500 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 TLE * 3 -- * 7 |
ソースコード
#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];int sqi[maxn];int sqf[maxn]; int arr[maxn][5]; int res[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;} for(int i=0;i<maxn;++i) {sqi[i]=(invf[i]*invf[i])%p;} for(int i=0;i<maxn;++i) {sqf[i]=(fact[i]*fact[i])%p;} int k;cin>>k; int n=30003; for(int z=1;z<=n;++z) { int pok=(z>2 ? po(z-2,k) : 0); int x=z-1; for(int y=1;y<x && x+y+z<=n;++y) { int u=(sqi[x]*sqi[y])%p; int fo=((x-y)*(x-y)*u)%p; arr[x+y][4]+=fo;arr[x+y][4]%=p; arr[x+y][3]+=(-2*x-2*y)*fo;arr[x+y][3]%=p; arr[x+y][2]+=((x*x+4*x*y+y*y)%p)*fo;arr[x+y][2]%=p; arr[x+y][1]+=((-2*x*y*(x+y))%p)*fo;arr[x+y][1]%=p; arr[x+y][0]+=((x*x*y*y)%p)*fo;arr[x+y][0]%=p; } for(int h=0;h<2*z && h+z<=n;++h) { if(h+z<3) continue; int va=(((pok*sqf[h+z-3])%p)*sqi[z])%p; int zs=1; for(int s=0;s<=4;++s) { res[h+z]+=(((va*zs)%p)*arr[h][s]);res[h+z]%=p; if(s<4) zs*=z;zs%=p; } } } cout<<n-3<<'\n'; for(int i=4;i<=n;++i) {cout<<res[i];if(i!=n) cout<<' ';} return 0; } /* 0 0 1 954786991 957671876 889065338 142889101 869246692 997557100*/