結果
| 問題 |
No.437 cwwゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-29 19:07:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,395 bytes |
| コンパイル時間 | 1,570 ms |
| コンパイル使用メモリ | 169,984 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-24 18:23:00 |
| 合計ジャッジ時間 | 3,483 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 1 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x) cerr << #x << " = " << (x) << endl
using namespace std;
// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else
const bool test = false;
#endif
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;
string s;
int dfs(int depth) {
int max_score = 0;
rep(i, s.size()) {
if (isalpha(s[i])) continue;
if (s[i] == 0) continue;
REP(j, i + 1, s.size()) {
if (isalpha(s[j])) continue;
REP(k, j + 1, s.size()) {
if (isalpha(s[k])) continue;
if (s[i] == s[j]) continue;
if (s[j] != s[k]) continue;
int cur_score =
(s[i] - '0') * 100
+ (s[j] - '0') * 10
+ (s[k] - '0') * 1;
string buf = s;
s[i] = s[j] = s[k] = 'a' + depth;
dump(cur_score);
dump(s);
cerr << endl;
int tmp = dfs(depth + 1) + cur_score;
if (tmp > max_score) max_score = tmp;
s = buf;
}
}
// dump(i);
// dump(max_score);
// cerr << endl;
}
return max_score;
}
signed main() {
cin >> s;
dump(s);
cout << dfs(0) << endl;
return 0;
}