結果

問題 No.3103 Range Chmax and Maximize Abs Sum
ユーザー SSRSSSRS
提出日時 2023-03-31 22:13:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 169,960 KB
実行使用メモリ 11,364 KB
最終ジャッジ日時 2023-10-24 08:16:23
合計ジャッジ時間 6,231 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 118 ms
4,348 KB
testcase_02 AC 118 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 73 ms
4,348 KB
testcase_07 AC 5 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 40 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000;
int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<long long> dp(N + 1, 0);
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= i; j++){
      for (int k = i + 1; k <= N; k++){
        dp[k] = max(dp[k], (long long) (k - j) * abs(A[i]));
      }
    }
  }
  cout << dp[N] << endl;
}
0