結果
問題 | No.1964 sum = length |
ユーザー | mkawa2 |
提出日時 | 2022-06-03 22:06:30 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,664 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,136 KB |
実行使用メモリ | 217,484 KB |
最終ジャッジ日時 | 2024-09-21 02:46:20 |
合計ジャッジ時間 | 35,697 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 100 ms
78,920 KB |
testcase_01 | AC | 71 ms
72,408 KB |
testcase_02 | AC | 170 ms
82,132 KB |
testcase_03 | AC | 68 ms
73,384 KB |
testcase_04 | AC | 101 ms
78,596 KB |
testcase_05 | AC | 107 ms
78,668 KB |
testcase_06 | AC | 114 ms
78,800 KB |
testcase_07 | AC | 122 ms
79,348 KB |
testcase_08 | AC | 128 ms
80,144 KB |
testcase_09 | AC | 133 ms
79,744 KB |
testcase_10 | AC | 138 ms
79,608 KB |
testcase_11 | AC | 143 ms
80,536 KB |
testcase_12 | AC | 264 ms
85,952 KB |
testcase_13 | AC | 355 ms
89,204 KB |
testcase_14 | AC | 487 ms
94,528 KB |
testcase_15 | AC | 620 ms
105,116 KB |
testcase_16 | AC | 166 ms
81,896 KB |
testcase_17 | AC | 289 ms
86,192 KB |
testcase_18 | AC | 317 ms
88,580 KB |
testcase_19 | AC | 234 ms
84,064 KB |
testcase_20 | AC | 246 ms
84,736 KB |
testcase_21 | AC | 161 ms
81,880 KB |
testcase_22 | AC | 1,745 ms
196,464 KB |
testcase_23 | AC | 1,697 ms
185,372 KB |
testcase_24 | AC | 1,015 ms
129,376 KB |
testcase_25 | AC | 1,159 ms
138,548 KB |
testcase_26 | AC | 1,881 ms
207,496 KB |
testcase_27 | AC | 1,378 ms
153,940 KB |
testcase_28 | AC | 1,102 ms
133,296 KB |
testcase_29 | AC | 1,561 ms
172,000 KB |
testcase_30 | AC | 1,176 ms
138,424 KB |
testcase_31 | AC | 1,897 ms
206,588 KB |
testcase_32 | AC | 699 ms
111,128 KB |
testcase_33 | AC | 679 ms
104,680 KB |
testcase_34 | AC | 1,682 ms
185,332 KB |
testcase_35 | AC | 888 ms
120,408 KB |
testcase_36 | AC | 1,269 ms
146,968 KB |
testcase_37 | AC | 1,534 ms
168,992 KB |
testcase_38 | TLE | - |
testcase_39 | AC | 1,149 ms
136,488 KB |
testcase_40 | AC | 1,199 ms
148,264 KB |
testcase_41 | AC | 1,808 ms
198,040 KB |
testcase_42 | TLE | - |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 n = II() m = n+230 dp = [[0]*m for _ in range(m)] ss = [[0]*(m+1) for _ in range(m)] dp[0][0] = 1 ss[0] = [0]+[1]*m for t in range(n): ndp = [[0]*m for _ in range(m)] nss = [[0]*(m+1) for _ in range(m)] for i in range(1, m): for j in range(1, m): # ndp[i][j] += sum(dp[i-2][j-1, j-9]) l, pi = max(0, j-9), i-2+(t == 0) if pi >= 0: ndp[i][j] += ss[pi][j]-ss[pi][l] # ndp[i][j] += sum(dp[i-3][j-10, j-99]) l, pi = max(0, j-99), i-3+(t == 0) if pi >= 0 and j-9>=0: ndp[i][j] += ss[pi][j-9]-ss[pi][l] # ndp[i][j] += sum(dp[i-4][j-100, j-999]) l, pi = max(0, j-999), i-4+(t == 0) if pi >= 0 and j-99>=0: ndp[i][j] += ss[pi][j-99]-ss[pi][l] nss[i][j+1] = (nss[i][j]+ndp[i][j])%md dp,ss=ndp,nss # p2D(dp) ans=0 for i in range(m): # print(i,dp[i][i]) ans+=dp[i][i] ans%=md print(ans)