# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1072076 |
2024-08-23T14:03:52 Z |
vjudge1 |
Addk (eJOI21_addk) |
C++17 |
|
2000 ms |
3980 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 |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
604 KB |
Output is correct |
5 |
Correct |
6 ms |
604 KB |
Output is correct |
6 |
Correct |
8 ms |
600 KB |
Output is correct |
7 |
Correct |
11 ms |
688 KB |
Output is correct |
8 |
Correct |
14 ms |
604 KB |
Output is correct |
9 |
Correct |
28 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
101 ms |
1364 KB |
Output is correct |
2 |
Correct |
226 ms |
1848 KB |
Output is correct |
3 |
Correct |
408 ms |
2368 KB |
Output is correct |
4 |
Correct |
1689 ms |
3636 KB |
Output is correct |
5 |
Execution timed out |
2062 ms |
3980 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |