Submission #642294

# Submission time Handle Problem Language Result Execution time Memory
642294 2022-09-19T08:01:35 Z glupan Addk (eJOI21_addk) C++14
92 / 100
1261 ms 5788 KB
    #include <bits/stdc++.h>

    using namespace std;

    void solve() {
        long long n,m;
        cin >> n >> m;
        long long dp[n+1], arr[n];
        dp[0]=0;
        for(long long i=0; i<n; i++) {
            cin >> arr[i];
            dp[i+1]=dp[i]+arr[i];
        }
        long long q;
        cin >> q;
        while(q--) {
            long long tmp,l,r,m;
            cin >> tmp;
            if(tmp==1) {
                long long 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 0 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 8 ms 392 KB Output is correct
5 Correct 11 ms 340 KB Output is correct
6 Correct 14 ms 444 KB Output is correct
7 Correct 18 ms 596 KB Output is correct
8 Correct 23 ms 660 KB Output is correct
9 Correct 41 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 804 KB Output is correct
2 Correct 289 ms 1908 KB Output is correct
3 Correct 447 ms 2452 KB Output is correct
4 Correct 859 ms 4292 KB Output is correct
5 Correct 1261 ms 5788 KB Output is correct
6 Correct 1103 ms 5564 KB Output is correct
7 Correct 977 ms 5588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2004 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -