結果

問題 No.1694 ZerOne
ユーザー shotoyooshotoyoo
提出日時 2021-10-01 22:08:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,350 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 111,452 KB
最終ジャッジ日時 2023-09-26 17:30:05
合計ジャッジ時間 10,014 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,324 KB
testcase_01 AC 72 ms
71,256 KB
testcase_02 AC 72 ms
71,160 KB
testcase_03 AC 226 ms
79,572 KB
testcase_04 AC 86 ms
76,340 KB
testcase_05 AC 106 ms
77,260 KB
testcase_06 AC 72 ms
71,540 KB
testcase_07 AC 97 ms
76,404 KB
testcase_08 AC 118 ms
77,640 KB
testcase_09 AC 245 ms
79,232 KB
testcase_10 AC 90 ms
76,292 KB
testcase_11 AC 72 ms
71,240 KB
testcase_12 AC 73 ms
71,088 KB
testcase_13 AC 133 ms
77,864 KB
testcase_14 AC 241 ms
79,364 KB
testcase_15 AC 103 ms
77,372 KB
testcase_16 AC 105 ms
77,460 KB
testcase_17 AC 84 ms
76,252 KB
testcase_18 AC 71 ms
71,284 KB
testcase_19 AC 74 ms
71,244 KB
testcase_20 AC 73 ms
71,296 KB
testcase_21 AC 1,350 ms
111,452 KB
testcase_22 AC 80 ms
76,228 KB
testcase_23 AC 1,299 ms
108,748 KB
testcase_24 AC 354 ms
82,608 KB
testcase_25 AC 345 ms
82,536 KB
testcase_26 AC 92 ms
76,296 KB
testcase_27 AC 1,003 ms
98,904 KB
testcase_28 AC 226 ms
79,872 KB
testcase_29 AC 134 ms
77,608 KB
testcase_30 AC 227 ms
79,264 KB
testcase_31 AC 279 ms
81,092 KB
testcase_32 AC 351 ms
82,576 KB
testcase_33 AC 340 ms
82,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

# list 多重リスト生成
def dlist(*l, fill=None):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]
s = list(map(int, input()))
n = len(s)
total = 0
num = 0
for i,c in enumerate(s):
    if c:
        total += i
        num += 1
dp = dlist(total+1, n+1, fill=0)
dp[0][0] = 1
for i in range(num):
    ndp = dlist(total+1, n+1, fill=0)
    for j in range(total+1):
        for p in range(n):
            val = dp[j][p]
            for k in range(p+1, n+1):
                if (k-1)+j > total:
                    break
                ndp[k-1+j][k] += val
    dp = ndp
ans = sum(dp[total])
print(ans)
0