結果
| 問題 |
No.107 モンスター
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-07-29 21:23:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 149 ms / 5,000 ms |
| コード長 | 1,406 bytes |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 87,664 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2024-12-18 01:45:39 |
| 合計ジャッジ時間 | 2,499 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
//#include <array>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int dp[1<<16][17];
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(16);//
int N;
cin>>N;
int D[16];
rep(i,N){
cin>>D[i];
}
dp[0][0] = 100;
for(int t=0;t<N;++t){//Nターン繰り返す
for(int i=0; i<N; ++i){
for(int k=(1<<N)-2;k>=0;--k){
if( ( (1<<i) & k ) == 0 ){
for(int Lv=0;Lv<N;++Lv){
if( dp[k][Lv] > 0 ){
if(D[i] > 0){
if( (Lv+1)*100 < dp[k][Lv] + D[i] ){
dp[(1<<i)|k][Lv] = (Lv+1)*100;
}else{
dp[(1<<i)|k][Lv] = max(dp[(1<<i)|k][Lv], dp[k][Lv]+D[i]);
}
}else{
if( dp[k][Lv] + D[i] > 0){
dp[(1<<i)|k][Lv+1] = max(dp[(1<<i)|k][Lv+1], dp[k][Lv]+D[i] ) ;
}
}
}
}
}
}
}
}
int ans = 0;
for(int i=0;i<=N;++i){
ans = max(ans,dp[(1<<N)-1][i]);
}
P(ans);
return 0;
}
IL_msta