結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
hayaD
|
| 提出日時 | 2016-08-11 21:26:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 889 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 81,200 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-24 17:24:10 |
| 合計ジャッジ時間 | 1,490 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 30 |
ソースコード
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()
int main(){
int N;
cin >> N;
int V[N];
FOR(i,0,N) cin >>V[i];
int mV[N];
mV[0] = V[0];
if(N == 0){
cout << mV[0] << endl;
return 0;
}
mV[1] = max(V[0],V[1]);
if(N == 1){
cout << mV[1] << endl;
return 0;
}
FOR(i,2,N){
int max = -1;
FOR(j,0,i-1){
if (V[i] + mV[j] > max) max = V[i] + mV[j];
}
if (max < mV[i-1]) max = mV[i-1];
mV[i] = max;
}
cout << mV[N-1] << endl;
return 0;
}
hayaD