結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2018-10-15 16:49:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 441 bytes |
| コンパイル時間 | 756 ms |
| コンパイル使用メモリ | 75,464 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 18:34:16 |
| 合計ジャッジ時間 | 1,760 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 7 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <queue>
using namespace std;
int main(){
int N;
cin >> N;
int V[N], dp[N];
for(int i=0; i<N; i++){
cin >> V[i];
dp[i] = V[i];
}
for(int i=0; i<N; i++){
for(int j=i+2; j<N; j++){
dp[j] = max(dp[j], dp[i]+V[j]);
}
}
cout << dp[N-1] << endl;
}