Submission #641930

# Submission time Handle Problem Language Result Execution time Memory
641930 2022-09-17T23:08:24 Z glupan Addk (eJOI21_addk) C++14
0 / 100
450 ms 640 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+4-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 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 430 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 450 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -