結果

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

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long int64;
const int INF = 1 << 30;

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

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

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

  for(int i = 0; i < M; i++) {
    vector< int > 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