結果
| 問題 | 
                            No.45 回転寿司
                             | 
                    
| ユーザー | 
                             Sounds_Of_Rain
                         | 
                    
| 提出日時 | 2015-08-10 11:24:22 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 690 bytes | 
| コンパイル時間 | 551 ms | 
| コンパイル使用メモリ | 86,804 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-24 10:16:00 | 
| 合計ジャッジ時間 | 4,665 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 4 | 
| other | RE * 30 | 
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <functional>
using namespace std;
typedef long long int llint;
const int INF = 1000000;
const llint LINF = 100000000;
int main() {
	int N;
	cin >> N;
	vector<int> V(N);
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	vector<int> dp(2);
	for (int i = 0; i < N; i++) {
		vector<int> dp2;
		dp2[0] = max(dp[0], dp[1]);
		dp2[1] = dp[0] + V[i];
		dp = dp2;
	}
	cout << max(dp[0], dp[1]) << endl;
	
	return 0;
}
            
            
            
        
            
Sounds_Of_Rain