#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
vector <ll> arr;
vector <ll> presum;
int main() {
ll n, k, q;
cin>>n>>k;
arr.resize(n);
presum.resize(n+1);
for(int i=0;i<n;i++) {
cin>>arr[i];
presum[i+1] = presum[i] + arr[i];
}
cin>>q;
for(ll j=0;j<q;j++) {
ll requestType;
cin>>requestType;
if(requestType == 2) {
ll sum = 0, l, r, m;
cin>>l>>r>>m;
for(ll i=l+m-1;i<=r;i++)
sum += presum[i]-presum[i-m];
cout<<sum<<'\n';
} else {
// we could use fanwick three
for(int i=0;i<k;i++)
{
ll tmp;
cin>>tmp;
}
continue;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
3 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
332 KB |
Output is correct |
4 |
Correct |
12 ms |
424 KB |
Output is correct |
5 |
Correct |
16 ms |
432 KB |
Output is correct |
6 |
Correct |
21 ms |
496 KB |
Output is correct |
7 |
Correct |
28 ms |
556 KB |
Output is correct |
8 |
Correct |
32 ms |
460 KB |
Output is correct |
9 |
Correct |
56 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
170 ms |
892 KB |
Output is correct |
2 |
Correct |
337 ms |
1624 KB |
Output is correct |
3 |
Correct |
566 ms |
2348 KB |
Output is correct |
4 |
Execution timed out |
2088 ms |
3504 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
898 ms |
1752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |