結果

問題 No.2136 Dice Calendar?
ユーザー とりゐとりゐ
提出日時 2022-12-03 20:52:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,820 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 443,344 KB
最終ジャッジ日時 2024-04-19 07:45:37
合計ジャッジ時間 26,605 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,968 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 60 ms
69,248 KB
testcase_03 AC 39 ms
51,968 KB
testcase_04 AC 42 ms
52,224 KB
testcase_05 AC 47 ms
60,928 KB
testcase_06 AC 45 ms
61,056 KB
testcase_07 AC 48 ms
61,568 KB
testcase_08 AC 48 ms
62,720 KB
testcase_09 AC 59 ms
68,096 KB
testcase_10 AC 62 ms
69,760 KB
testcase_11 AC 90 ms
87,680 KB
testcase_12 AC 114 ms
98,816 KB
testcase_13 AC 92 ms
89,856 KB
testcase_14 AC 149 ms
115,456 KB
testcase_15 AC 458 ms
192,564 KB
testcase_16 AC 661 ms
250,832 KB
testcase_17 AC 464 ms
202,612 KB
testcase_18 AC 1,667 ms
257,432 KB
testcase_19 AC 2,106 ms
297,096 KB
testcase_20 AC 2,678 ms
287,984 KB
testcase_21 AC 2,953 ms
303,812 KB
testcase_22 AC 4,374 ms
363,424 KB
testcase_23 AC 4,820 ms
443,344 KB
testcase_24 AC 37 ms
51,712 KB
testcase_25 AC 111 ms
90,752 KB
testcase_26 AC 4,018 ms
353,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

fac=[1]
for i in range(1,100):
  fac.append(fac[-1]*i%mod)

finv=[]
for i in range(100):
  finv.append(pow(fac[i],mod-2,mod))

n=int(input())
s=[]
for i in range(n):
  s.append(list(map(lambda x:int(x)-1,input().split())))
s.sort()
S=set([0])

for si in s:
  nS=set()
  for i in S:
    for j in si:
      nS.add(i+(1<<(5*j)))
  S=nS

ans=0
for bit in S:
  res=fac[n]
  for j in range(9):
    x=bit&31
    res*=finv[x]
    res%=mod
    bit>>=5  
  ans+=res

print(ans%mod)
0