結果
| 問題 | 
                            No.45 回転寿司
                             | 
                    
| ユーザー | 
                             kongarishisyamo
                         | 
                    
| 提出日時 | 2016-05-13 15:47:12 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 414 bytes | 
| コンパイル時間 | 490 ms | 
| コンパイル使用メモリ | 56,980 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-24 11:46:37 | 
| 合計ジャッジ時間 | 6,773 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 4 | 
| other | RE * 30 | 
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
#define NMAX 1000
#define VMAX 100
#define INF -((NMAX+1)*(VMAX+1)+1)
int main(){
	int dp[2][NMAX+1];
	int N,V;
	cin>>N;
	for(int i=0;i<=2;i++){
		for(int j=0;j<=N;j++){
			dp[i][j]=INF;
		}
	}
	dp[0][0]=0;
	for(int i=1;i<=N;i++){
		cin>>V;
		dp[0][i]=max(dp[0][i-1],dp[1][i-1]);
		dp[1][i]=dp[0][i-1]+V;
	}
	cout<<max(dp[0][N],dp[1][N])<<endl;
}
            
            
            
        
            
kongarishisyamo