This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100'000;
int n, k, q;
long long A[MAXN];
int main(){
if(scanf("%d %d", &n, &k)){}
for (int i = 0; i < n; i++)
if(scanf("%lld", &A[i])){}
long t, l, r, m;
long long res;
if(scanf("%d", &q)){}
vector<long long> out;
for (int i = 0; i < q; i++){
if(scanf("%ld", &t)){}
if (t == (long)2){
if(scanf("%ld %ld %ld", &l, &r, &m)){}
res = 0, r--, l--;
for (int i = l; i <= r; i++)
res += (min({m - 1, i - l, r - i + 1}) + ((r - i + 1) >= m)) * A[i];
out.push_back(res);
}
else
for (int i = 0; i < k; i++)
if(scanf("%ld", &l)){}
}
for (auto i : out)
printf("%lld\n", i);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |