Submission #501073

# Submission time Handle Problem Language Result Execution time Memory
501073 2022-01-02T10:27:30 Z uncripted Addk (eJOI21_addk) C++11
0 / 100
716 ms 2572 KB
#include<bits/stdc++.h>
using namespace std;
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];
	}
	long long q;
	cin>>q;
	while(q--){
		long long x;
		cin>>x;
		if(x==1){
			continue;
			
		}
		long long l,r,m;
		cin>>l>>r>>m;
		
		long long s=0;
		for(long long j=l; j<=r; j++){
		long long l1,r2;
			l1=max(j-m+1, l);
			r2=min(j+m-1, r);
			s+=a[j]*(r2-l1+1);
		}
		cout<<s<<endl;
	}
	
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 105 ms 876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 716 ms 2572 KB Output isn't correct
2 Halted 0 ms 0 KB -