# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
501103 |
2022-01-02T11:15:58 Z |
uncripted |
Addk (eJOI21_addk) |
C++11 |
|
255 ms |
6448 KB |
#include<bits/stdc++.h>
using namespace std;
long long prefix[100005];
long long pre[100005];
int main(){
long long n,k;
cin>>n>>k;
long long a[n+1];
for(long long i=1; i<=n; i++){
cin>>a[i];
pre[i]+=pre[i-1]+a[i];
prefix[i]=prefix[i-1]+pre[i];
}
long long q;
cin>>q;
while(q--){
long long x;
cin>>x;
if(x==1){
int y;
cin>>y;
continue;
}
long long l,r,m;
cin>>l>>r>>m;
long long s=0;
s+=prefix[r]-prefix[l+m-2];
if(l-2>=0){
s-=prefix[r-m]-prefix[l-2];
}else{
s-=prefix[r-m];
}
cout<<s<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
7 ms |
332 KB |
Output is correct |
5 |
Correct |
9 ms |
408 KB |
Output is correct |
6 |
Correct |
11 ms |
464 KB |
Output is correct |
7 |
Correct |
14 ms |
460 KB |
Output is correct |
8 |
Correct |
16 ms |
520 KB |
Output is correct |
9 |
Correct |
22 ms |
616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
956 KB |
Output is correct |
2 |
Correct |
69 ms |
1944 KB |
Output is correct |
3 |
Correct |
94 ms |
2516 KB |
Output is correct |
4 |
Correct |
165 ms |
4420 KB |
Output is correct |
5 |
Correct |
255 ms |
6448 KB |
Output is correct |
6 |
Correct |
211 ms |
6260 KB |
Output is correct |
7 |
Correct |
214 ms |
6196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
111 ms |
2152 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |