#include<bits/stdc++.h>
#define io_opt ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int N = 1e6 + 10;
int n,k,t;
int x[N];
int main() {
io_opt;
ll ans = 0;
cin >> n >> k;
for(int i=1;i<=n;i++){
cin >> t;
ans += (i % 2 ? t : -t);
}
for(int i=1;i<=k;i++) cin >> x[i];
int op = k % 2; // 0为Bob 1为Alice
for(int i=1;i<=k;i++){
if(i%2 == op){ //最后一个人:绝对值变大
if(op) ans = abs(ans) + x[i];
else ans = -abs(ans) - x[i];
}
else{ //不是最后一个人:绝对值变小
ans = abs(ans) - x[i];
}
}
cout << ans << endl;
return 0;
}
代码如上,一个测试点都没过