Submission #1071563

# Submission time Handle Problem Language Result Execution time Memory
1071563 2024-08-23T08:49:40 Z vjudge1 Addk (eJOI21_addk) C++17
0 / 100
609 ms 1488 KB
#include <bits/stdc++.h>
#define int long long
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
const int N=1e6+1;
const int inf=1e18;
const int mod=1e9+7;
using namespace std;
vector<int>v;
signed main(){
	boost;
	int n,k;
	cin>>n>>k;
	v.push_back(0);
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		v.push_back(x);
	}
	int q;
	cin>>q;
	while(q--){
		int type;
		cin>>type;
		if(type==1){
			int x;
			cin>>x;
		}else{
			int l,r,m;
			cin>>l>>r>>m;
			int ans=0;
			int cnt=0;
			for(int i=l;i<=r;i++){
				cnt=min(i-l,r-i);
				cnt=min(cnt+1,m);
				ans+=v[i]*cnt;
			}
			cout<<ans<<"\n";
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 292 ms 984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 609 ms 1488 KB Output isn't correct
2 Halted 0 ms 0 KB -