結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2025-03-26 16:01:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 1,850 ms |
コンパイル使用メモリ | 191,856 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-26 16:01:47 |
合計ジャッジ時間 | 3,294 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }