题解
2023-07-16 14:20:09
发布于:河北
25阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int s[100005][2], sum[100005][2], c[100005], x[100005];
int n, m, ans;
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> x[i];
}
for (int i = 1; i <= n; i++) {
cin >> c[i];
s[c[i]][i % 2];
sum[c[i]][i % 2] = (sum[c[i]][i % 2] + x[i]) % 10007;
}
for (int i = 1; i <= n; i) {
ans = (ans + i * ((s[c[i]][i % 2] - 2) * x[i] % 10007 + sum[c[i]][i % 2])) % 10007;
}
cout<<ans;
return 0;
}
这里空空如也
有帮助,赞一个