結果
問題 | No.2503 Typical Path Counting Problem on a Grid |
ユーザー | 👑 p-adic |
提出日時 | 2023-10-26 09:58:10 |
言語 | cLay (20240104-1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 391 bytes |
コンパイル時間 | 4,283 ms |
コンパイル使用メモリ | 203,504 KB |
実行使用メモリ | 49,904 KB |
最終ジャッジ日時 | 2023-10-26 09:58:31 |
合計ジャッジ時間 | 14,951 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,093 ms
46,628 KB |
testcase_01 | AC | 1,201 ms
47,348 KB |
testcase_02 | AC | 1,269 ms
49,688 KB |
testcase_03 | AC | 1,130 ms
47,460 KB |
testcase_04 | AC | 1,343 ms
49,904 KB |
testcase_05 | AC | 1,283 ms
49,684 KB |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | AC | 1,344 ms
49,892 KB |
ソースコード
#define MD 998244353 ll@T,@(N,M)[T],L=1d7+1,n[T],m;map<ll,Matrix<Mint>>t;rep(i,T)t[n[i]=min(N[i],M[i])];Mint A[L]{1},p;Matrix<Mint>X(2,2),Y(2,1),Z=X;Z[0][0]=Z[1][1]=1;X[1][0]=1;t[0]=Z;rep(i,1,L){A[i]=2i*A[i-1]+(i-1)*A[max(0,i-2)],X[0][0]+=2,X[0][1]++,Z=Z*X;if(t.count(i))t[i]=Z;}rep(i,T)m=n[i],X[0][0]=2m+1,X[0][1]=m,Y[0][0]=A[m],Y[1][0]=A[max(0,m-1)],Y=t[m]*X**(N[i]+M[i]-2m)*Y,wt(Y[0][0]);