过样例,wa3 T7.
先不管TLE,谁能帮我解决万恶的WA???
#include<bits/stdc++.h>
#define re register int
#define rll register long long
const int mul=19260817;
using namespace std;
int n, m;
inline int read()
{
re x = 0;
char ch = getchar();
while (ch < '0' || ch > '9')ch = getchar();
while (ch >= '0' && ch <= '9')x = x * 10 + ch - '0', ch = getchar();
return x;
}
inline void write(rll x)
{
if (x > 9) {
write(x / 10);
}
putchar(x % 10 + '0');
}
int dist[200001],sum[200001],x,l,r,ans;
int main()
{
n = read(), m = read();
for(re i = 2;i <= n;i ++)dist[i] = read() + dist[i - 1];
for(re i = 1;i <= n;i ++)sum[i] = read();
while(m --)
{
x = read(), l = read(), r = read();
ans = 0;
for(re i = l;i <= r;i ++)
{
ans += ((sum[i] % mul) * (abs(dist[i] - dist[x]) % mul)) % mul;
}
write(ans);
putchar('\n');
}
return 0;
}