結果

問題 No.2136 Dice Calendar?
ユーザー とりゐとりゐ
提出日時 2022-12-03 20:54:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,134 ms / 5,000 ms
コード長 565 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 449,440 KB
最終ジャッジ日時 2024-04-19 07:46:49
合計ジャッジ時間 23,607 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,272 KB
testcase_01 AC 37 ms
52,868 KB
testcase_02 AC 68 ms
77,548 KB
testcase_03 AC 36 ms
52,064 KB
testcase_04 AC 37 ms
52,000 KB
testcase_05 AC 48 ms
63,616 KB
testcase_06 AC 47 ms
63,912 KB
testcase_07 AC 48 ms
65,160 KB
testcase_08 AC 50 ms
66,760 KB
testcase_09 AC 63 ms
76,436 KB
testcase_10 AC 67 ms
79,728 KB
testcase_11 AC 105 ms
104,352 KB
testcase_12 AC 137 ms
121,500 KB
testcase_13 AC 116 ms
108,984 KB
testcase_14 AC 182 ms
128,860 KB
testcase_15 AC 532 ms
257,164 KB
testcase_16 AC 723 ms
257,364 KB
testcase_17 AC 546 ms
256,348 KB
testcase_18 AC 1,539 ms
315,684 KB
testcase_19 AC 1,871 ms
356,376 KB
testcase_20 AC 2,199 ms
341,452 KB
testcase_21 AC 2,393 ms
328,728 KB
testcase_22 AC 3,627 ms
389,864 KB
testcase_23 AC 4,134 ms
449,440 KB
testcase_24 AC 36 ms
52,960 KB
testcase_25 AC 176 ms
134,084 KB
testcase_26 AC 3,596 ms
400,060 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=[0]

for si in s:
  nS=[]
  for i in S:
    for j in si:
      nS.append(i+(1<<(5*j)))
  nS.sort()
  S=[]
  last=-1
  for i in nS:
    if i!=last:
      S.append(i)
      last=i

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