# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1020306 | vjudge1 | Addk (eJOI21_addk) | C++17 | 2053 ms | 3528 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,k;
cin>>n>>k;
vector<int> vec;
for(;n>0;n--)
{
int x;
cin>>x;
vec.push_back(x);
}
int q;
cin>>q;
for(;q>0;q--)
{
int x;
cin>>x;
if(x==1)
{
for(int k1=k;k1>0;k1--)
{
int a;
cin>>a;
}
}
else
{
int l,r,m;
cin>>l>>r>>m;
l--;
r--;
long long p1=l,p2=l,sum=0,res=0;
for(;p2<m+l;p2++)
{
sum=sum+vec[p2];
}
p2--;
for(;p2<=r;p2++,p1++)
{
res=res+sum;
sum=sum-vec[p1];
if(p2!=vec.size()-1)
sum=sum+vec[p2+1];
}
cout<<res<<endl;
}
}
return 0;
}
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... |