結果

問題 No.2575 Almost Increasing Sequence
ユーザー maksimmaksim
提出日時 2023-12-09 00:32:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7,741 ms / 10,000 ms
コード長 1,888 bytes
コンパイル時間 2,612 ms
コンパイル使用メモリ 217,196 KB
実行使用メモリ 6,548 KB
スコア 600,000
最終ジャッジ日時 2023-12-09 00:34:49
合計ジャッジ時間 166,228 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7,626 ms
6,548 KB
testcase_01 AC 7,647 ms
6,548 KB
testcase_02 AC 7,687 ms
6,548 KB
testcase_03 AC 7,681 ms
6,548 KB
testcase_04 AC 7,703 ms
6,548 KB
testcase_05 AC 7,672 ms
6,548 KB
testcase_06 AC 7,688 ms
6,548 KB
testcase_07 AC 7,687 ms
6,548 KB
testcase_08 AC 7,713 ms
6,548 KB
testcase_09 AC 7,741 ms
6,548 KB
testcase_10 AC 7,734 ms
6,548 KB
testcase_11 AC 7,700 ms
6,548 KB
testcase_12 AC 7,668 ms
6,548 KB
testcase_13 AC 7,677 ms
6,548 KB
testcase_14 AC 7,677 ms
6,548 KB
testcase_15 AC 7,666 ms
6,548 KB
testcase_16 AC 7,680 ms
6,548 KB
testcase_17 AC 7,657 ms
6,548 KB
testcase_18 AC 7,669 ms
6,548 KB
testcase_19 AC 7,679 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int p=998244353;
const int maxn=30005;
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*/
0