Submission #641713

# Submission time Handle Problem Language Result Execution time Memory
641713 2022-09-17T13:26:41 Z glupan Addk (eJOI21_addk) C++14
0 / 100
489 ms 1708 KB
#include <bits/stdc++.h>

using namespace std;

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

    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i=0; i<n; i++)
        cin >> a[i];
    int q;
    cin >> q;
    while(q--) {
        int x;
        cin >> x;
        if(x==1) {
            int y;
            cin >> y;
        }
        if(x==2) {
            int l,r,m;
            long long ans=0;
            cin >> l >> r >> m;
            l--;
            r--;
            int cnt=min(m,r-l+2-m);
            for(int i=l; i<=r; i++)
                ans+=a[i]*min(cnt,min(i-l,r-i)+1);
            cout << ans << endl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 7 ms 336 KB Output is correct
4 Correct 15 ms 408 KB Output is correct
5 Correct 23 ms 456 KB Output is correct
6 Incorrect 33 ms 472 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 450 ms 1124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 489 ms 1708 KB Output isn't correct
2 Halted 0 ms 0 KB -