이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e5+7;
ll n,k,q,tre,tz,l,r,m;
ll pre[maxn];
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n>>k;
for(ll i = 0; i<n; i++){
cin>>tre;
pre[i+1]=pre[i]+tre;
}
cin>>q;
for(ll i = 0;i<q; i++){
cin>>tre;
if(tre==1){
cin>>l;
}
else{
cin>>l>>r>>m;
ll od = 0;
int f = min(m,(r-l+1)-m+1);
for(ll p = 0; p<f; p++){
od+=pre[r]-pre[l-1];
r--;
l++;
}
cout<<od<<'\n';
}
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |