結果

問題 No.1694 ZerOne
ユーザー ぷらぷら
提出日時 2021-10-01 21:48:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 199,160 KB
実行使用メモリ 106,376 KB
最終ジャッジ日時 2023-09-26 16:58:47
合計ジャッジ時間 4,061 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
13,628 KB
testcase_01 AC 2 ms
5,468 KB
testcase_02 AC 4 ms
13,676 KB
testcase_03 AC 31 ms
91,752 KB
testcase_04 AC 5 ms
21,932 KB
testcase_05 AC 14 ms
54,740 KB
testcase_06 AC 2 ms
5,424 KB
testcase_07 AC 12 ms
46,524 KB
testcase_08 AC 16 ms
60,872 KB
testcase_09 AC 30 ms
88,812 KB
testcase_10 AC 12 ms
48,508 KB
testcase_11 AC 2 ms
7,528 KB
testcase_12 AC 4 ms
13,672 KB
testcase_13 AC 17 ms
65,060 KB
testcase_14 AC 29 ms
89,664 KB
testcase_15 AC 14 ms
56,748 KB
testcase_16 AC 12 ms
50,676 KB
testcase_17 AC 6 ms
23,912 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 43 ms
106,356 KB
testcase_21 AC 43 ms
106,376 KB
testcase_22 AC 40 ms
104,424 KB
testcase_23 AC 41 ms
106,324 KB
testcase_24 AC 42 ms
106,368 KB
testcase_25 AC 42 ms
106,308 KB
testcase_26 AC 39 ms
102,460 KB
testcase_27 AC 38 ms
100,528 KB
testcase_28 AC 25 ms
85,556 KB
testcase_29 AC 28 ms
87,624 KB
testcase_30 AC 31 ms
91,488 KB
testcase_31 AC 38 ms
100,612 KB
testcase_32 AC 36 ms
96,816 KB
testcase_33 AC 38 ms
100,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long dp[61][61][3601];

int main() {
    string S;
    cin >> S;
    int sum1 = 0,sum2 = 0;
    for(int i = 0; i < S.size(); i++) {
        sum1 += S[i]-'0';
    }
    for(int i = 0; i < S.size(); i++) {
        for(int j = i; j < S.size(); j++) {
            if(S[i] > S[j]) {
                sum2++;
            }
        }
    }
    dp[0][0][0] = 1;
    for(int i = 0; i < S.size(); i++) {
        for(int j = 0; j < S.size(); j++) {
            for(int k = 0; k < S.size()*S.size(); k++) {
                dp[i+1][j+1][k] += dp[i][j][k];
                dp[i+1][j][k+j] += dp[i][j][k];
            }
        }
    }
    cout << dp[S.size()][sum1][sum2] << endl;
}
0