結果
問題 | No.45 回転寿司 |
ユーザー |
|
提出日時 | 2020-06-12 19:12:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 277 bytes |
コンパイル時間 | 1,979 ms |
コンパイル使用メモリ | 195,472 KB |
最終ジャッジ日時 | 2025-01-11 01:59:30 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int n; cin>>n; vector<int>v(n); for(auto&&i:v)cin>>i; vector<int>dp(n+2,0); for(int i=0;i<n;++i){ dp.at(i+2)=max(dp.at(i+1),dp.at(i)+v.at(i)); } cout<<dp.back()<<"\n"s; }