結果

問題 No.2503 Typical Path Counting Problem on a Grid
ユーザー 👑 p-adicp-adic
提出日時 2023-10-26 09:30:55
言語 cLay
(20240420-1)
結果
TLE  
実行時間 -
コード長 357 bytes
コンパイル時間 4,116 ms
コンパイル使用メモリ 194,128 KB
実行使用メモリ 594,128 KB
最終ジャッジ日時 2023-10-26 09:31:24
合計ジャッジ時間 28,709 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353
ll@T,L=10**7+1;Mint A[L]{1,2},p;Matrix<Mint>X(2,2),Y(2,1),Z[L];Z[0]=Z[1]=X;Z[0][0][0]=Z[0][1][1]=1;rep(i,1,L)A[i]=2i*A[i-1]+(i-1)*A[max(0,i-2)],Z[i]=X,Z[i][0][0]=2i,Z[i][0][1]=i,Z[i][1][0]=1,Z[i]=Z[i-1]*Z[i];rep(T){ll@N,@M,n=min(N,M);X[0][0]=2n+1;X[0][1]=n;X[1][0]=1;Y[0][0]=A[n];Y[1][0]=A[max(0,n-1)];Y=Z[n]*X**(N+M-2n)*Y;wt(Y[0][0]);}
0