# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631964 | Jovan26 | Addk (eJOI21_addk) | C++14 | 262 ms | 736 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>
using namespace std;
int main(){
int n;
cin>>n;
int k;
cin>>k;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int q;
cin>>q;
vector<int> v;
for(int j=0;j<q;j++){
int x;
cin>>x;
if(x==1){
int y;
cin>>y;
continue;
}
int l,r,m;
cin>>l>>r>>m;
int rez = 0;
for(int i=l-1;i<l+m-2;i++){
rez+=(i-l+2)*a[i];
}
for(int i=r-1;i>r-m;i--){
rez+=(r-i)*a[i];
}
for(int i=l+m-2;i<=r-m;i++){
rez+=a[i]*m;
}
v.push_back(rez);
}
for(int i=0;i<v.size();i++) cout<<v[i]<<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... |