#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
using namespace std;
const int N = (int)1e5 + 7;
int n, k, q, a[N];
int main() {
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
for(int i = 1; i <= n; ++i) cin >> a[i];
cin >> q;
while(q--) {
char tp;
cin >> tp;
if(tp == '1') {
vector<int> v(k);
for(auto &x : v) cin >> x;
continue;
int o = a[v[0]];
for(int i = 0; i < k - 1; ++i) a[v[i]] = a[v[i + 1]];
a[v.back()] = o;
} else {
int l, r, m;
cin >> l >> r >> m;
ll ans = 0;
for(int i = l; i <= r; ++i) {
ans += a[i] * min(i - l + 1, m);
}
cout << ans << nl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
279 ms |
648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1117 ms |
916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |