Submission #641931

# Submission time Handle Problem Language Result Execution time Memory
641931 2022-09-17T23:08:40 Z glupan Addk (eJOI21_addk) C++14
0 / 100
459 ms 632 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+3-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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 424 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 459 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -