Submission #641932

# Submission time Handle Problem Language Result Execution time Memory
641932 2022-09-17T23:08:51 Z glupan Addk (eJOI21_addk) C++14
0 / 100
454 ms 672 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 0 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 14 ms 404 KB Output is correct
5 Correct 28 ms 464 KB Output is correct
6 Incorrect 33 ms 468 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 432 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 454 ms 672 KB Output isn't correct
2 Halted 0 ms 0 KB -