답안 #768414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
768414 2023-06-28T05:58:42 Z elotelo966 Addk (eJOI21_addk) C++17
92 / 100
38 ms 5880 KB
//bu sefer olacak
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000005
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
int dizi[100005],pre[100005];

int32_t main(){
    fast
    int n,m,deg,cev;cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>dizi[i];
        dizi[i]=dizi[i-1]+dizi[i];
    }
    for(int i=1;i<=n;i++){
        pre[i]=pre[i-1]+dizi[i];
    }
    int q;cin>>q;
    while(q--){
        int ty;cin>>ty;
        if(ty==2){
            int l,r,m;
            cin>>l>>r>>m;
            cev=pre[r]-pre[l+m-2];
            if(l-2>=0)cev-=pre[r-m]-pre[l-2];
            else cev-=pre[r-m]-pre[0];
            cout<<cev<<'\n';
        }
        else{
            for(int i=0;i<m;i++)cin>>deg;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 3 ms 472 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 5 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1368 KB Output is correct
2 Correct 11 ms 1876 KB Output is correct
3 Correct 15 ms 2488 KB Output is correct
4 Correct 27 ms 4184 KB Output is correct
5 Correct 38 ms 5880 KB Output is correct
6 Correct 34 ms 5528 KB Output is correct
7 Correct 35 ms 5520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -