結果

問題 No.437 cwwゲーム
ユーザー dazydazy
提出日時 2018-06-07 18:27:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,550 bytes
コンパイル時間 1,345 ms
コンパイル使用メモリ 158,692 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 13:20:18
合計ジャッジ時間 2,262 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
testcase_39 AC 1 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 1 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

string n;
int len, ans;

int get_cww(bool x[]) {
    int a, b, c, ret = 0;
    bool y[13];
    rep(i, 0, len) y[i] = x[i];
    rep(i, 0, len-2) {
        a = n[i] - '0';
        if(a!=0) {
            rep(j, i+1, len-1) {
                b = n[j] - '0';
                if(a!=b) {
                    rep(k, j+1, len) {
                        c = n[k] - '0';
                        if(b==c && x[i] && x[j] && x[k]) {
                            int nc = a*100 + b*11;
                            y[i] = y[j] = y[k] = false;
                            nc += get_cww(y);
                            y[i] = y[j] = y[k] = true;
                            ret = max(ret, nc);
                        }
                    }
                }
            }
        }
    }
    return ret;
}

int main() {
    fastcin;
    cin >> n;
    len = n.size();
    bool b[13];
    rep(i, 0, len) b[i] = true;
    ans = get_cww(b);
    print(ans);
    return 0;
}
0