Submission #1072079

# Submission time Handle Problem Language Result Execution time Memory
1072079 2024-08-23T14:04:16 Z vjudge1 Addk (eJOI21_addk) C++14
36 / 100
2000 ms 2392 KB
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;

const int N = 100002;
ll n, K, pref[N];
int a[N], q;
short int op;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	cin >> n >> K;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];

	pref[0] = 0;
	for (int i = 1; i <= n; ++i)
		pref[i] = pref[i - 1] + a[i];

	q; cin >> q;
	for (int tc = 1; tc <= q; ++tc) {
		cin >> op;
		if (op == 1) {
			int x; cin >> x;
			continue;
		}
		else {
			int l, r, m;
			cin >> l >> r >> m;

			ll sum = 0;
			int tl = l + m - 1;
			while (tl <= r) {
				sum += pref[tl] - pref[tl - m];
				tl++;
			}
			cout << sum << '\n';
		}
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:23:2: warning: statement has no effect [-Wunused-value]
   23 |  q; cin >> q;
      |  ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 8 ms 464 KB Output is correct
7 Correct 11 ms 604 KB Output is correct
8 Correct 14 ms 564 KB Output is correct
9 Correct 27 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 100 ms 848 KB Output is correct
2 Correct 219 ms 1100 KB Output is correct
3 Correct 398 ms 1364 KB Output is correct
4 Correct 1627 ms 2312 KB Output is correct
5 Execution timed out 2056 ms 2392 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1132 KB Output isn't correct
2 Halted 0 ms 0 KB -