Submission #475810

# Submission time Handle Problem Language Result Execution time Memory
475810 2021-09-24T05:59:43 Z Tkesho Addk (eJOI21_addk) C++14
0 / 100
1076 ms 3988 KB
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
 
vector <ll> arr;
vector <ll> presum;
 
int main() {
	ll n, k, q;
	cin>>n>>k;
	arr.resize(n);
	presum.resize(n+1);
	
	for(int i=0;i<n;i++) {
		cin>>arr[i];
		presum[i+1] = presum[i] + arr[i];
		
		cout<<presum[i]<<" ";
	}

	cin>>q;
	
	for(ll j=0;j<q;j++) {
		ll requestType;
		cin>>requestType;
		
		if(requestType == 2) {
			ll sum = 0, l, r, m;
			cin>>l>>r>>m;

			for(ll i=l+m-1;i<=r;i++)
				sum += presum[i]-presum[i-m];
			
			cout<<sum<<'\n';
		} else {
			// we could use fanwick three
			for(int i=0;i<k;i++)
			{
				ll tmp;
				cin>>tmp;
			}
			continue;
		}
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 247 ms 1336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1076 ms 3988 KB Output isn't correct
2 Halted 0 ms 0 KB -