#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nn "\n";
#define pb push_back
const int N = 1e6 + 8 , inf = 1e17 ;
int n , k , a[N] ,q ;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin>> n >> k ;
int 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;
if (h == 1)continue;
int sum = 0;
int j = 1;
while (l < r) {
sum += a[l] * j + a[r] * j;
l++;
r--;
j = min(j + 1 , m );
}
if (l == r) {
sum += a[l] * j;
}
cout << sum << nn
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
184 ms |
1076 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
350 ms |
3616 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |