Submission #583761

# Submission time Handle Problem Language Result Execution time Memory
583761 2022-06-26T07:41:16 Z Ivkosqn Addk (eJOI21_addk) C++14
0 / 100
32 ms 1804 KB
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int maxn = 1e5 + 1;
int n, k, a[maxn];
unsigned long long p[maxn], pref[maxn];

void solve(){
    int q;
    cin >> q;
    while(q--){
        int type;
        cin >> type;
        if(type == 1){
            for(int i = 0;i < k;i++){
                int a;
                cin >> a;
            }
            continue;
        }
        int l, r, m;
        cin >> l >> r >> m;
        unsigned long long ans = 0;
        ans = pref[r] - pref[l + m - 2];
        ans = ans - (pref[r - m] - pref[min(0, l - 2)]);
        cout << ans << endl;
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        p[i] = p[i - 1] + a[i];
    }
    for(int i = 1;i <= n;i++){
        pref[i] = pref[i - 1] + p[i];
    }
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 1804 KB Output isn't correct
2 Halted 0 ms 0 KB -