Submission #642290

# Submission time Handle Problem Language Result Execution time Memory
642290 2022-09-19T07:59:04 Z glupan Addk (eJOI21_addk) C++14
0 / 100
125 ms 1716 KB
    #include <bits/stdc++.h>

    using namespace std;

    void solve() {
        int n,m;
        cin >> n >> m;
        int dp[n+1], arr[n];
        dp[0]=0;
        for(int i=0; i<n; i++) {
            cin >> arr[i];
            dp[i+1]=dp[i]+arr[i];
        }
        int q;
        cin >> q;
        while(q--) {
            int tmp,l,r,m;
            cin >> tmp;
            if(tmp==1) {
                int x; cin >> x;
                continue;
            }
            cin >> l >> r >> m;
            long long ans=0;
            for(int i=0; i<m; i++) {
                ans+=dp[r-i]-dp[l+i-1];
            }
            cout << ans << endl;
        }
    }

    int main() {
        ios::sync_with_stdio(false);
        cin.tie(NULL);

        int t=1;
        while(t--)
            solve();
    }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 10 ms 456 KB Output is correct
6 Incorrect 14 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 1124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -