結果
問題 |
No.3215 Make K types-able
|
ユーザー |
![]() |
提出日時 | 2025-07-27 04:23:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 657 bytes |
コンパイル時間 | 439 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 26,580 KB |
最終ジャッジ日時 | 2025-07-27 04:23:15 |
合計ジャッジ時間 | 6,930 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 -- * 9 |
ソースコード
import sys input = sys.stdin.readline from functools import lru_cache @lru_cache(maxsize=None) def f(n,k): if n==1: if k==1: return 2 else: return 0 if n==2: if k==1: return 5 if k==2: return 2 if k==3: return 1 return 0 if k==1: ANS=pow(2,pow(2,n,mod-1)-2,mod) else: ANS=0 for i in range(k+1): ANS+=f(n-1,i+1)*f(n-1,k-i) ANS%=mod return ANS mod=998244353 T=int(input()) for tests in range(T): N,K=map(int,input().split()) ANS=f(N,K) print(ANS%mod)