Submission #600076

# Submission time Handle Problem Language Result Execution time Memory
600076 2022-07-20T12:40:54 Z Jovan26 Addk (eJOI21_addk) C++14
0 / 100
305 ms 852 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int q;
	cin>>q;
	long long sums[q];
	int u = 0;
	if(k==1){
		for(int i=0;i<q;i++){
			int x;
			cin>>x;
			if(x==1){
				int y;
				cin>>y;
				continue;
			}
			else{
				int l,r,m;
				cin>>l>>r>>m;
				long long  s = 0;
				int d = r-l+1;
				for(int j=l-1; j<=r-1; j++){
					int p = j-l+2;
					if(p<m){
					s+=a[j]*p;
				}
				else if(d-p+1<m){
					s+=a[j]*(d-p+1);
				}
				else{
					s+=a[j]*m;
				}
				}
				sums[u] = s;
				u++;
			}
		}
	}
	for(int i=0;i<u-1;i++){
		cout<<sums[i]<<endl;
	}
	cout<<sums[u-1];
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 305 ms 772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -