#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn "\n";
#define pb push_back
const int N = 1e5 + 8 ;
int n , k ;
ll a[N] ,q ;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin>> n >> k ;
ll p[n+1];
p[0] =0 ;
for(int i= 1 ; i <= n ; i++){
cin>> a[i];
p[i] = p[i-1]+a[i];
}
cin>> q ;
while(q--){
int h , l , r , m ;
cin>> h ;
if(h == 1 ){
int x ;
cin>> x ;
}
else {
cin >> l >> r >> m;
ll ans =0 ;
int go = l ;
while(go+m - 1 <= r){
ans+=(p[go+m - 1] - p[go - 1]);
go++;
}
cout << ans << nn
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
388 KB |
Output is correct |
4 |
Correct |
3 ms |
536 KB |
Output is correct |
5 |
Correct |
5 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
588 KB |
Output is correct |
7 |
Correct |
10 ms |
604 KB |
Output is correct |
8 |
Correct |
14 ms |
636 KB |
Output is correct |
9 |
Correct |
27 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
852 KB |
Output is correct |
2 |
Correct |
220 ms |
1104 KB |
Output is correct |
3 |
Correct |
401 ms |
1616 KB |
Output is correct |
4 |
Correct |
1608 ms |
2384 KB |
Output is correct |
5 |
Execution timed out |
2005 ms |
2644 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
203 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |