Submission #1035238

# Submission time Handle Problem Language Result Execution time Memory
1035238 2024-07-26T07:27:54 Z makanhulia Addk (eJOI21_addk) C++17
36 / 100
2000 ms 3560 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 

signed main(){
    int n,k;
    cin>>n>>k;
    if(k==1){
        int a[n+1];
        for(int q=1;q<=n;q++){
            cin>>a[q];
        }
        int u;
        cin>>u;
        while(u--){
            int ans=0;
            int sum=0;
            int type,l,r,m;
            cin>>type;
            if(type==1){
                int a;
                cin>>a;
                continue;
            }
            cin>>l>>r>>m;
            int cnt=1;
            for(int q=l;q<=r;q++){
                if(cnt<=m){
                    sum+=a[q];
                }
                else{
                    ans+=sum;
                    sum-=a[q-m];
                    sum+=a[q];
                }
                cnt++;
                //cout<<ans<<endl;
            }
            ans+=sum;
            cout<<ans<<endl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 5 ms 508 KB Output is correct
4 Correct 12 ms 604 KB Output is correct
5 Correct 14 ms 604 KB Output is correct
6 Correct 20 ms 632 KB Output is correct
7 Correct 27 ms 652 KB Output is correct
8 Correct 36 ms 852 KB Output is correct
9 Correct 64 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 224 ms 1108 KB Output is correct
2 Correct 446 ms 1616 KB Output is correct
3 Correct 842 ms 2264 KB Output is correct
4 Execution timed out 2068 ms 3560 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -