結果
| 問題 | No.664 超能力者Aと株価予測 | 
| コンテスト | |
| ユーザー |  nxteru | 
| 提出日時 | 2018-08-13 23:00:19 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 843 bytes | 
| コンパイル時間 | 721 ms | 
| コンパイル使用メモリ | 82,892 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 08:20:29 | 
| 合計ジャッジ時間 | 1,672 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 WA * 1 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
int n,m,k;
int dp[400][25],a[400],ans;
int main(void){
    cin>>n>>m>>k;
    dp[0][m]=k;
    n++;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<=m;j++){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
            if(j==0)continue;
            int o=dp[i][j]/a[i];
            for(int l=i+1;l<n;l++){
                dp[l+1][j-1]=max(dp[l+1][j-1],dp[i][j]+o*(a[l]-a[i]));
            }
        }
    }
    for(int i=0;i<=m;i++)ans=max(ans,dp[n][i]);
    cout<<ans;
}
            
            
            
        