# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1072091 |
2024-08-23T14:13:05 Z |
vjudge1 |
Addk (eJOI21_addk) |
C++17 |
|
2000 ms |
3668 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, ans = 0;
int tl = l, tr = l + m - 1;
for (int i = tl; i <= tr; ++i)
sum += a[i];
ans += sum;
while (tr < r) {
sum -= a[tl++];
sum += a[++tr];
ans += sum;
}
cout << ans << '\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 |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
6 ms |
348 KB |
Output is correct |
5 |
Correct |
10 ms |
600 KB |
Output is correct |
6 |
Correct |
14 ms |
688 KB |
Output is correct |
7 |
Correct |
19 ms |
680 KB |
Output is correct |
8 |
Correct |
26 ms |
708 KB |
Output is correct |
9 |
Correct |
61 ms |
872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
217 ms |
1360 KB |
Output is correct |
2 |
Correct |
446 ms |
1876 KB |
Output is correct |
3 |
Correct |
849 ms |
2384 KB |
Output is correct |
4 |
Execution timed out |
2066 ms |
3668 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1102 ms |
2188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |