# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472919 | fuad27 | Addk (eJOI21_addk) | C++17 | 1018 ms | 3004 KiB |
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>
#define int long long
using namespace std;
int32_t main () {
int n, k;
cin >> n >> k;
int arr[n];
for(int i = 0;i<n;i++) {
cin >> arr[i];
}
int q;
cin >> q;
while(q--) {
int k, ans = 0;
cin >> k;
if(k == 1) {
int d;
cin >> d;
}
else {
int ans = 0;
int l, r, m;
cin >> l >> r >> m;
l--;
m = min(r-l-m+2, m);
for(int i = l;i<r;i++) {
ans += min(m, min(i-l+1, r-i))*arr[i];
}
cout<<ans<<endl;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |