이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
int main()
{
int n,k,q;
cin >> n >> k;
int a[n];
for (int i=0;i<n;i++)
cin >> a[i];
cin >> q;
int type,p,l,r,m;
for (int i=0;i<q;i++)
{
cin >> type;
if (type==1)
{
cin >> p;
continue;
}
cin >> l >> r >> m;
l--,r--;
long long vk=0;
for (int j=l;j<l+m;j++)
vk+=a[j];
long long window_sum=vk;
int left=l,right=l+m;
while (right<=r)
{
window_sum+=a[right]-a[left];
vk+=window_sum;
left++;
right++;
}
cout << vk << endl;
}
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... |