結果
問題 | No.2503 Typical Path Counting Problem on a Grid |
ユーザー | 👑 p-adic |
提出日時 | 2023-10-26 09:59:37 |
言語 | cLay (20240104-1) |
結果 |
AC
|
実行時間 | 1,741 ms / 2,000 ms |
コード長 | 401 bytes |
コンパイル時間 | 4,331 ms |
コンパイル使用メモリ | 202,568 KB |
実行使用メモリ | 49,288 KB |
最終ジャッジ日時 | 2023-10-26 09:59:59 |
合計ジャッジ時間 | 20,889 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,208 ms
46,628 KB |
testcase_01 | AC | 1,231 ms
47,344 KB |
testcase_02 | AC | 1,619 ms
49,064 KB |
testcase_03 | AC | 1,268 ms
47,460 KB |
testcase_04 | AC | 1,741 ms
49,280 KB |
testcase_05 | AC | 1,646 ms
49,060 KB |
testcase_06 | AC | 1,367 ms
49,288 KB |
testcase_07 | AC | 1,368 ms
49,288 KB |
testcase_08 | AC | 1,337 ms
49,288 KB |
testcase_09 | AC | 1,708 ms
49,272 KB |
ソースコード
#define MD 998244353 ll@T,@(N,M)[T],L=1d7+1,n[T],m;unordered_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]);