結果

問題 No.664 超能力者Aと株価予測
ユーザー ei1333333ei1333333
提出日時 2018-03-10 00:27:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 199,308 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 06:07:33
合計ジャッジ時間 3,099 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 5 ms
6,944 KB
testcase_09 WA -
testcase_10 AC 9 ms
6,944 KB
testcase_11 AC 14 ms
6,944 KB
testcase_12 AC 19 ms
6,940 KB
testcase_13 AC 12 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long int64;
const int64 INF = 1LL << 60;

int main() {
  int N, M, K, A[391];

  cin >> N >> M >> K;
  ++N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }

  vector< int64 > dp(N + 1, K);

  for(int i = 0; i < M; i++) {
    vector< int64 > dp2(dp);
    for(int j = 0; j < N; j++) {
      int sm = A[j];
      for(int k = j + 1; k < N; k++) {
        int sz = dp[j] / sm;
        dp2[k + 1] = max(dp2[k + 1], dp[j] % sm + sz * A[k]);

        sm = min(sm, A[k]);
      }
    }
    dp.swap(dp2);
  }

  cout << *max_element(begin(dp), end(dp)) << endl;
}
0