結果

問題 No.1694 ZerOne
ユーザー yakkiyakki
提出日時 2021-10-01 22:31:43
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 1,213 bytes
コンパイル時間 1,050 ms
コンパイル使用メモリ 118,604 KB
実行使用メモリ 118,016 KB
最終ジャッジ日時 2023-09-26 18:24:42
合計ジャッジ時間 4,737 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,736 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,672 KB
testcase_03 AC 108 ms
86,460 KB
testcase_04 AC 7 ms
7,504 KB
testcase_05 AC 39 ms
32,588 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 27 ms
23,800 KB
testcase_08 AC 46 ms
38,572 KB
testcase_09 AC 103 ms
83,188 KB
testcase_10 AC 30 ms
25,372 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,676 KB
testcase_13 AC 55 ms
45,148 KB
testcase_14 AC 102 ms
83,260 KB
testcase_15 AC 42 ms
34,452 KB
testcase_16 AC 35 ms
28,812 KB
testcase_17 AC 8 ms
8,436 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 145 ms
117,992 KB
testcase_21 AC 145 ms
117,940 KB
testcase_22 AC 141 ms
114,176 KB
testcase_23 AC 146 ms
117,932 KB
testcase_24 AC 145 ms
117,984 KB
testcase_25 AC 146 ms
118,016 KB
testcase_26 AC 135 ms
110,476 KB
testcase_27 AC 130 ms
106,880 KB
testcase_28 AC 92 ms
74,016 KB
testcase_29 AC 99 ms
80,128 KB
testcase_30 AC 111 ms
89,780 KB
testcase_31 AC 132 ms
106,928 KB
testcase_32 AC 123 ms
99,912 KB
testcase_33 AC 131 ms
106,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<ctime>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0)

const double EPS = 1e-18;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
//using mint = modint998244353;

int dh[] = {-1,1,0,0};
int dw[] = {0,0,1,-1};

ll dp[66][66][4000];

int main(){
    string s; cin >> s;
    int n = (int)s.size();
    int rev = 0;
    int cnt1 = 0;
    rep(i,n){
        if(s[i] == '0') rev += cnt1;
        else cnt1++;
    }
    dp[0][0][0] = 1;
    rep(i,n)rep(j,n+1)rep(k,4000){
        if(k-j >= 0) dp[i+1][j][k] += dp[i][j][k-j];
        if(j-1 >= 0) dp[i+1][j][k] += dp[i][j-1][k];
    }
    cout << dp[n][cnt1][rev] << endl;
}
0