結果
| 問題 |
No.437 cwwゲーム
|
| コンテスト | |
| ユーザー |
TangentDay
|
| 提出日時 | 2016-10-28 23:46:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,173 bytes |
| コンパイル時間 | 711 ms |
| コンパイル使用メモリ | 83,892 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 06:52:25 |
| 合計ジャッジ時間 | 2,191 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 1 |
ソースコード
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
int dfs(VI a, VI f){
int res = 0, n = a.size();
REP(i,n){
FOR(j,i+1,n-1){
FOR(k,j+1,n-1){
if (f[i] || f[j] || f[k]) continue;
if (a[i] != a[j] && a[j] == a[k]){
f[i] = f[j] = f[k] = 1;
int x = 100*a[i] + 10*a[j] + a[k];
res = max(res, x+dfs(a, f));
f[i] = f[j] = f[k] = 0;
}
}
}
}
return res;
}
int main(){
string s;
cin >> s;
int n = s.length();
VI a(n), f(n);
REP(i,n) a[i] = s[i] - '0';
cout << dfs(a, f) << endl;
return 0;
}
TangentDay