#include #include #include #include #include using namespace std; static void setup() { cin.tie(0); ios::sync_with_stdio(false); } struct Action { int pos; int point; }; static void run() { int n; cin >> n; vector vs(n + 3, 0); for (auto i = 1; i <= n; ++i) { cin >> vs[i]; } vector dp(n + 3, 0); dp[0] = 0; dp[1] = vs[1]; for (auto i = 2; i <= n; ++i) { dp[i] = max(dp[i - 2] + vs[i], dp[i - 1]); } cout << dp[n] << endl; } int main(int argc, char **argv) { setup(); run(); return 0; }