#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const int N = 100010;
int a[N],b[N],c[N],d[N];
int main() {
int n;
int ma,mb;
cin >> n >> ma;
for(int i = 1; i<=ma;i++) {
int x;
cin >> x;
a[i] = x;
}
cin >> mb;
for(int i = 1; i<= mb;i++) {
int x;
cin >> x;
b[i] = x;
}
for(int i = 1; i< mb;i++) {
if(max(a[i+ 1],b[i+ 1])==0)c[i]=2;
else
c[i] = max(a[i+ 1],b[i+ 1])+ 1;
}
int t1 = 0, t2 = 0;
int s = 0;
int w = 0;
for(int i = 1; i < ma;i++) {
a[i+1] += a[i]*c[i];
s =a[i]*c[i];
w += s;
}
for(int i = 1; i < ma;i++) {
b[i+1] += b[i]*c[i];
s =a[i]*c[i];
w += s;
}
cout << a[ma]- b[ma];
//cout << 241;
return 0;
}
技术分享官
- 粉丝: 1758
- 资源: 401