結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2023-08-26 21:29:59 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 3,409 ms |
コンパイル使用メモリ | 163,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 00:21:49 |
合計ジャッジ時間 | 3,939 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int N=1e3+9; int n,a[N],dp[N]; int main(){ #ifdef memset0 freopen("1.in","r",stdin); #endif ios::sync_with_stdio(0),cin.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; dp[i]=max(dp[i-1],dp[i-2]+a[i]); } cout<<dp[n]<<endl; }