Submission #632437

# Submission time Handle Problem Language Result Execution time Memory
632437 2022-08-20T04:21:20 Z pragmatist Addk (eJOI21_addk) C++17
0 / 100
650 ms 956 KB
#include<bits/stdc++.h>

#define ll long long
#define nl "\n"

using namespace std;

const int N = (int)1e5 + 7;

int n, k, q, a[N];

int main() {
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	cin >> q;
	while(q--) {
		char tp;
		cin >> tp;
		if(tp == '1') {
			continue;
		} else {
			int l, r, m;
			cin >> l >> r >> m;
			ll sum = 0, ans = 0;
			for(int i = l; i <= l + m - 1; ++i) sum += a[i];
			ans += sum;
			for(int i = l + m; i <= r; ++i) {
				sum += a[i];
				sum -= a[i - m];
				ans += sum;
			}    
			cout << ans << nl;
		}
	}
	return 0;
}
# 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 176 ms 540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 650 ms 956 KB Output isn't correct
2 Halted 0 ms 0 KB -