結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
kakeyamay
|
| 提出日時 | 2019-06-29 14:14:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 5,000 ms |
| コード長 | 281 bytes |
| コンパイル時間 | 1,931 ms |
| コンパイル使用メモリ | 195,056 KB |
| 最終ジャッジ日時 | 2025-01-07 05:42:48 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
int main() {
int N;
std::cin >> N;
std::vector<int> V(N);
for(auto&v:V)std::cin>>v;
std::vector<int> dp(N+2,0);
dp[1]=V[0];
for(int i=0;i<N;++i){
dp[i+2]=std::max(dp[i+1],dp[i]+V[i+1]);
}
int ans = dp[N];
std::cout << ans << std::endl;
}
kakeyamay