| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1352162 | jakovg | Addk (eJOI21_addk) | C++20 | 2094 ms | 580 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int q;
cin >> q;
while (q--) {
int x;
cin >> x;
if (x == 1) {
int b[k];
for (int i = 0; i < k; i++) {
cin >> b[i];
b[i]--;
}
int temp = a[b[0]];
for (int i = 0; i < k - 1; i++) {
a[b[i]] = a[b[i + 1]];
}
a[b[k - 1]] = temp;
} else {
int l, r, m;
cin >> l >> r >> m;
l--; r--;
ll sum = 0;
for (int i = l; i <= r - m + 1; i++) {
for (int j = i; j < i + m; j++) {
sum += a[j];
}
}
cout << sum << "\n";
}
}
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
