結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2018-10-15 16:50:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 818 ms |
コンパイル使用メモリ | 75,796 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 18:34:18 |
合計ジャッジ時間 | 1,534 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 20 WA * 10 |
ソースコード
#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[0]; } 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; }