結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2019-04-28 09:19:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 369 bytes |
コンパイル時間 | 2,184 ms |
コンパイル使用メモリ | 159,412 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-14 16:49:08 |
合計ジャッジ時間 | 2,379 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 18 |
ソースコード
#include<bits/stdc++.h> using namespace std; int N; vector<int> V(1009); int memo[1009][4]; int main(){ cin >> N; for(int i=1;i<=N;i++)cin >> V[i]; memo[1][1]=V[1]; memo[2][1]=V[2]; for(int i=3;i<=N;i++){ memo[i][1]=max(memo[i-1][0]+V[i],memo[i-2][0]+V[i]); memo[i][0]=max(memo[i-1][1],memo[i-2][1]); } cout << max(memo[N][1],memo[N][0]) << endl; }