結果
問題 | No.2788 4-33 Hard |
ユーザー | flygon |
提出日時 | 2024-06-15 01:26:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 158 ms / 2,000 ms |
コード長 | 1,641 bytes |
コンパイル時間 | 537 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 78,768 KB |
最終ジャッジ日時 | 2024-06-15 01:26:35 |
合計ジャッジ時間 | 11,114 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 157 ms
78,592 KB |
testcase_01 | AC | 154 ms
78,380 KB |
testcase_02 | AC | 153 ms
78,548 KB |
testcase_03 | AC | 146 ms
78,444 KB |
testcase_04 | AC | 146 ms
78,464 KB |
testcase_05 | AC | 145 ms
78,400 KB |
testcase_06 | AC | 149 ms
78,208 KB |
testcase_07 | AC | 151 ms
78,592 KB |
testcase_08 | AC | 155 ms
78,336 KB |
testcase_09 | AC | 137 ms
78,552 KB |
testcase_10 | AC | 150 ms
78,336 KB |
testcase_11 | AC | 137 ms
78,308 KB |
testcase_12 | AC | 158 ms
78,336 KB |
testcase_13 | AC | 143 ms
78,324 KB |
testcase_14 | AC | 146 ms
78,356 KB |
testcase_15 | AC | 137 ms
78,312 KB |
testcase_16 | AC | 154 ms
78,492 KB |
testcase_17 | AC | 134 ms
78,504 KB |
testcase_18 | AC | 151 ms
78,336 KB |
testcase_19 | AC | 145 ms
78,204 KB |
testcase_20 | AC | 146 ms
78,536 KB |
testcase_21 | AC | 132 ms
78,288 KB |
testcase_22 | AC | 132 ms
78,264 KB |
testcase_23 | AC | 135 ms
78,436 KB |
testcase_24 | AC | 156 ms
78,572 KB |
testcase_25 | AC | 144 ms
78,440 KB |
testcase_26 | AC | 144 ms
78,304 KB |
testcase_27 | AC | 138 ms
78,312 KB |
testcase_28 | AC | 133 ms
78,276 KB |
testcase_29 | AC | 145 ms
78,728 KB |
testcase_30 | AC | 155 ms
78,320 KB |
testcase_31 | AC | 153 ms
78,272 KB |
testcase_32 | AC | 156 ms
78,592 KB |
testcase_33 | AC | 153 ms
78,248 KB |
testcase_34 | AC | 136 ms
78,316 KB |
testcase_35 | AC | 136 ms
78,512 KB |
testcase_36 | AC | 138 ms
78,376 KB |
testcase_37 | AC | 137 ms
78,432 KB |
testcase_38 | AC | 155 ms
78,064 KB |
testcase_39 | AC | 135 ms
78,212 KB |
testcase_40 | AC | 133 ms
78,324 KB |
testcase_41 | AC | 146 ms
78,456 KB |
testcase_42 | AC | 139 ms
78,184 KB |
testcase_43 | AC | 138 ms
78,244 KB |
testcase_44 | AC | 139 ms
78,508 KB |
testcase_45 | AC | 140 ms
78,376 KB |
testcase_46 | AC | 157 ms
78,752 KB |
testcase_47 | AC | 140 ms
78,636 KB |
testcase_48 | AC | 138 ms
78,600 KB |
testcase_49 | AC | 140 ms
78,560 KB |
testcase_50 | AC | 142 ms
78,768 KB |
testcase_51 | AC | 137 ms
78,320 KB |
testcase_52 | AC | 136 ms
78,648 KB |
testcase_53 | AC | 143 ms
78,664 KB |
testcase_54 | AC | 150 ms
78,588 KB |
testcase_55 | AC | 152 ms
78,336 KB |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd mod = 998244353 O = [list(map(int,input().split())) for i in range(5)] X = [list(map(int,input().split())) for i in range(5)] all = [] for i in range(5): for j in range(34): all.append([i,j]) cnum = [[[1]*10 for i in range(34)] for i in range(5)] for i in range(5): for j in range(34): for k in range(1,10): cnum[i][j][k] =cnum[i][j][k-1] * (O[i][j]-k+1) * pow(k, mod-2, mod) % mod cnum[i][j][k] %= mod ord = [0] divm = [] def div(tot): if tot == 8: divm.append(ord[::1]) return for i in range(1,9): if i < ord[-1]: continue if tot + i > 8:break ord.append(i) div(tot + i) ord.pop() div(0) ans = 0 dp = [[[0]*34 for i in range(5)] for i in range(9)] dp[0][0][0] = 1 for dx,dy in all: new = [[[0]*34 for i in range(5)] for i in range(9)] for lx,ly in all: for lcnt in range(0,9): new[lcnt][lx][ly] += dp[lcnt][lx][ly] new[lcnt][lx][ly] %= mod for cnt in range(1,9): if lx+dx*cnt > 4 or ly+dy*cnt > 33: continue if lcnt + cnt > 8:break if i >= 1: new[lcnt+cnt][lx+dx*cnt][ly+dy*cnt] += dp[lcnt][lx][ly]*cnum[dx][dy][cnt] new[lcnt+cnt][lx+dx*cnt][ly+dy*cnt] %= mod dp = new for i in range(5): ans += dp[-1][4-i][33]*X[i][0]%mod ans %= mod print(ans)