Submission #1071588

# Submission time Handle Problem Language Result Execution time Memory
1071588 2024-08-23T09:06:50 Z vjudge1 Addk (eJOI21_addk) C++17
0 / 100
630 ms 3924 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nn "\n";
#define pb push_back
const int N = 1e6 + 8  , inf = 1e17 ;
int  n ,  k , a[N] ,q ;
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin>> n >> k ;
    int p[n+1];
    p[0] =0 ;
    for(int i= 1 ; i <= n ; i++){
        cin>> a[i];
        p[i] = p[i-1]+a[i];
    }
    cin>> q ;
    while(q--){
        int h , l , r , m ;
        cin>> h >> l >> r >> m ;
        if(h == 1 )continue;
        int sum = p[r] - p[l-1];
        for(int i =l , j = 0 ; i <= l + m - 1 ; i++ , j ++){
            sum+=a[i]*j;
        }
        for(int i = r , j =0  ; i >= r - m + 1 ; i-- , j++){
            sum+=a[i]*j;
        }
        cout << sum<< nn
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 630 ms 3924 KB Output isn't correct
2 Halted 0 ms 0 KB -