結果
| 問題 | No.258 回転寿司(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-15 01:08:15 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 1,537 ms |
| コンパイル使用メモリ | 212,660 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-15 01:08:38 |
| 合計ジャッジ時間 | 20,342 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 67 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
long long C=0;
cin >> n;
vector<long long> a(n+1), dp(n+1, LLONG_MIN);
for(int i=1;i<=n;i++) cin >> a[i];
long long ans = 0;
for(int i=1;i<=n;i++){
dp[i] = a[i];
for(int j=1;j<=i-2;j++){
dp[i] = max(dp[i], dp[j] + a[i] - C*(i-j));
}
ans = max(ans, dp[i]);
}
cout << ans << "\n";
}