#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];
cout<<presum[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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
247 ms |
1336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1076 ms |
3988 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |