結果

問題 No.1694 ZerOne
ユーザー 👑 rin204rin204
提出日時 2023-01-24 16:12:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,360 KB
実行使用メモリ 80,628 KB
最終ジャッジ日時 2023-09-08 10:57:08
合計ジャッジ時間 6,593 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,168 KB
testcase_01 AC 76 ms
70,736 KB
testcase_02 AC 75 ms
71,096 KB
testcase_03 AC 114 ms
77,636 KB
testcase_04 AC 79 ms
75,832 KB
testcase_05 AC 82 ms
75,900 KB
testcase_06 AC 73 ms
70,940 KB
testcase_07 AC 85 ms
75,932 KB
testcase_08 AC 87 ms
76,008 KB
testcase_09 AC 106 ms
77,760 KB
testcase_10 AC 84 ms
75,964 KB
testcase_11 AC 73 ms
71,012 KB
testcase_12 AC 72 ms
71,116 KB
testcase_13 AC 87 ms
75,912 KB
testcase_14 AC 106 ms
77,612 KB
testcase_15 AC 85 ms
75,932 KB
testcase_16 AC 84 ms
75,980 KB
testcase_17 AC 80 ms
75,472 KB
testcase_18 AC 74 ms
71,216 KB
testcase_19 AC 74 ms
70,724 KB
testcase_20 AC 132 ms
80,412 KB
testcase_21 AC 129 ms
79,828 KB
testcase_22 AC 128 ms
79,620 KB
testcase_23 AC 130 ms
80,412 KB
testcase_24 AC 128 ms
79,948 KB
testcase_25 AC 136 ms
80,272 KB
testcase_26 AC 128 ms
79,288 KB
testcase_27 AC 124 ms
80,472 KB
testcase_28 AC 100 ms
77,900 KB
testcase_29 AC 104 ms
78,228 KB
testcase_30 AC 108 ms
77,280 KB
testcase_31 AC 123 ms
80,368 KB
testcase_32 AC 119 ms
80,100 KB
testcase_33 AC 124 ms
80,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
n = len(S)
dp = [[0] * (n * n) for _ in range(1)]
dp[0][0] = 1
for t in range(1, n + 1):
    ndp = [[0] * (n * n) for _ in range(t + 1)]
    for i in range(t):
        for j in range(n * n):
            if dp[i][j] == 0:
                continue
            ndp[i + 1][j] += dp[i][j]
            ndp[i][j + i] += dp[i][j]
    dp = ndp
o = 0
inv = 0
for s in S:
    if s == '1':
        o += 1
    else:
        inv += o
print(dp[o][inv])
0