#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
const int N = 200'000, inf = 1'000'000'000;
const i64 infl = 1'000'000'000'000'000'000;
#define ff first
#define ss second
#define pb push_back
#define ins insert
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define NO cout << "NO\n"
#define YES cout << "YES\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int __tc = 1;
int n, k, q;
int a[N+5], p[N+5], d[N+5];
void solve() {
for (int i = 1; i <= n; i++) p[i] = p[i-1] + a[i];
for (int i = 1, tp, xi, yi, zi; i <= q; i++) {
cin >> tp;
if (tp == 1) {
for (int j = 1; j <= k; j++) cin >> d[j];
}
if (tp == 2) {
cin >> xi >> yi >> zi;
i64 res = 0;
for (int j = xi; j + zi - 1 <= yi; j++) res += p[j + zi - 1] - p[j - 1];
cout << res << '\n';
}
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
// cin >> __tc;
for (int _tc = 1; _tc <= __tc; _tc++) {
cin >> n >> k;
for (int i = 1; i <= n; i++) cin >> a[i];
cin >> q;
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |