// No.45 回転寿司 #include #include using namespace std; int main() { int N; cin >> N; vector V(N); for (int i = 0; i < N; ++i) cin >> V[i]; vector> dp(N + 1, vector(2)); for (int i = 0; i < N; ++i) { dp[i + 1][1] = dp[i][0] + V[i]; dp[i + 1][0] = max(dp[i][0], dp[i][1]); } cout << max(dp[N][0], dp[N][1]) << endl; }