結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2017-02-09 09:57:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 606 bytes |
| コンパイル時間 | 571 ms |
| コンパイル使用メモリ | 62,164 KB |
| 実行使用メモリ | 13,696 KB |
| 最終ジャッジ日時 | 2024-12-25 17:14:28 |
| 合計ジャッジ時間 | 176,194 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 2 TLE * 28 |
ソースコード
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
using namespace std;
#define REP(i,first,last) for (int i=first;i<last;i++)
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
const int MAX_N = 100;
const int MAX_V = 100;
int N;
vector<int> v_list;
int solve(int idx, int total){
if (idx >= N) return total;
int res_1 = solve(idx + 1, total);
int res_2 = solve(idx + 2, total + v_list[idx]);
return MAX(res_1, res_2);
}
int main(){
cin >> N;
int val;
REP(i,0,N){
cin >> val;
v_list.push_back(val);
}
cout << solve(0, 0) << endl;
}