結果
問題 | No.437 cwwゲーム |
ユーザー |
![]() |
提出日時 | 2017-07-10 12:52:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 1,727 ms |
コンパイル使用メモリ | 169,416 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 06:59:05 |
合計ジャッジ時間 | 3,456 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 WA * 1 RE * 1 |
ソースコード
#include <bits/stdc++.h>#define REP(i,n,N) for(int i=(n);i<(int) N;i++)#define p(s) cout<<(s)<<endlusing namespace std;string s;int dp[1 << 12];int main() {cin>>s;int n=s.size();REP(mask, 0, 1<<n) {REP(i, 0, n) {REP(j,i+1,n){REP(k,j+1,n){if (!(mask & (1<<i))&&!(mask & (1<<j))&&!(mask & (1<<k))&&s[i]!=0&&s[i]!=s[j]&&s[j]==s[k]){dp[mask | (1 << i)|(1 << j)|(1 << k)] = max(dp[mask | (1 << i)|(1 << j)|(1 << k)],dp[mask]+100*(s[i]-'0')+10*(s[j]-'0')+s[k]-'0');}}}}}p(dp[(1<<n)-1]);return 0;}