답안 #1071333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071333 2024-08-23T06:44:45 Z vjudge1 Addk (eJOI21_addk) C++17
36 / 100
2000 ms 3920 KB
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;

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

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

	vector<ll> pref(n + 1);
	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 ans = 0;

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

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:21:2: warning: statement has no effect [-Wunused-value]
   21 |  q; cin >> q;
      |  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 8 ms 348 KB Output is correct
5 Correct 11 ms 604 KB Output is correct
6 Correct 15 ms 644 KB Output is correct
7 Correct 19 ms 604 KB Output is correct
8 Correct 24 ms 740 KB Output is correct
9 Correct 42 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 132 ms 1372 KB Output is correct
2 Correct 271 ms 1872 KB Output is correct
3 Correct 461 ms 2388 KB Output is correct
4 Correct 1779 ms 3844 KB Output is correct
5 Execution timed out 2024 ms 3920 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 1368 KB Output isn't correct
2 Halted 0 ms 0 KB -