#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e6;
ll n, k;
ll arr[maxn];
ll pref[maxn];
ll q;
int main(){
cin >> n >> k;
for(ll i = 1; i <= n; i++){
cin >> arr[i];
pref[i] = arr[i];
pref[i] += pref[i-1];
}
cin >> q;
while(q--){
ll quer; cin >> quer;
ll l, r, m;
if(quer == 2){
cin >> l >> r >> m;
ll hasil = 0;
// cerr << "l & r : " << l << " " << r-m+1 << endl;
for(ll i = l; i <= r-m+1; i++){
// cerr << "pref : " << pref[i+m-1] << " - " << pref[i-1] << endl;
hasil += pref[i+m-1] - pref[i-1];
// cerr << "hasil : " << hasil << endl;
}
cout << hasil << endl;
}else{
cin >> l >> r >> m;
}
}
// for(ll i = 1; i <= n; i++) cerr << pref[i] << " ";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
79 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
134 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |