結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2017-12-17 18:45:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 1,620 ms |
| コンパイル使用メモリ | 165,640 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 22:46:41 |
| 合計ジャッジ時間 | 2,916 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 7 |
ソースコード
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD 1000003
#define INF 100000000
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;
int main() {
int n;
cin >> n;
int v[1010] = {};
REP(i, n) cin >> v[i];
int s[1010] = {};
REP(i, n) s[i + 1] = v[i];
FOR(i, 3, n + 1) {
if (s[i - 2] >= s[i - 3]) s[i] += s[i - 2];
else s[i] += s[i - 3];
}
cout << s[n] << endl;
return 0;
}