#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 16; int n, y, a, b, dp[2][3]; // dp[i][0]表示对当前a不操作的最大值,dp[i][1]表示对当前a+b的最大值,dp[i][2]表示对当前a-b的最大值 // dp[0]表示前k个数的三种情况的最大值,dp[1]表示当前执行的第k + 1个数,因此只保留两行 inline void work(int i, int t) { for (int j = 0; j < 3; ++j) ...