Submission #516281

# Submission time Handle Problem Language Result Execution time Memory
516281 2022-01-21T02:24:33 Z MinhQNgo Addk (eJOI21_addk) C++17
0 / 100
773 ms 3160 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 5;

long long ps[N];
int a[N];

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        ps[i] = a[i] + ps[i - 1];
    }
    int q;
    cin >> q;
    while (q--) {
        int t;
        cin >> t;
        if (t == 1) {
            int ind;
            for (int i = 1; i <= k; i++) cin >> ind;
        }
        else {
            int l, r, m;
            cin >> l >> r >> m;
            long long ans = 0;
            for (int i = l; i <= r - m + 1; i++) {
                ans += ps[i + m] - ps[i];
            }
            cout << ans << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 1188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 773 ms 3160 KB Output isn't correct
2 Halted 0 ms 0 KB -