結果
| 問題 | 
                            No.45 回転寿司
                             | 
                    
| ユーザー | 
                             n_knuu
                         | 
                    
| 提出日時 | 2015-10-29 15:31:15 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 659 bytes | 
| コンパイル時間 | 3,303 ms | 
| コンパイル使用メモリ | 157,536 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-27 12:28:32 | 
| 合計ジャッジ時間 | 3,438 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 30 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
int dp[1024];
int V[1024];
int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  REP(i, N) cin >> V[i];
  int sushi = 0;
  REP(i, N) {
    dp[i+1] = max(dp[i], sushi + V[i]);
    sushi = max(sushi, dp[i]);
  }
  cout << dp[N] << endl;
  return 0;
}
            
            
            
        
            
n_knuu