답안 #1036103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036103 2024-07-27T03:35:55 Z andecaandeci Addk (eJOI21_addk) C++17
36 / 100
2000 ms 4072 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main(){
    int n,k;
    cin>>n>>k;
    ll a[n+1],p1[n+1],p2[n+1];
    a[0]=p1[0]=p2[0]=0;
    for(int i=1;i<=n;i++)cin>>a[i];
    int q;
    cin>>q;
    while(q--){
        int t;
        cin>>t;
        if(t==2){
            int l,r,m;
            cin>>l>>r>>m;
            for(int i=1;i<=n;i++){
                p1[i]=p1[i-1]+a[i];
                p2[i]=p2[i-1]+p1[i];
            }
            ll ans=p2[r]-p2[l+m-2]-p2[r-m];
            if(l>1)ans+=p2[l-2];
            cout<<ans<<'\n';
        }else{
            int x[k];
            for(int i=0;i<k;i++)cin>>x[i];
            int p=a[x[0]];
            for(int i=0;i<k-1;i++)a[x[i]]=a[x[i+1]];
            a[x[k-1]]=p;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 7 ms 348 KB Output is correct
4 Correct 18 ms 348 KB Output is correct
5 Correct 20 ms 604 KB Output is correct
6 Correct 32 ms 684 KB Output is correct
7 Correct 40 ms 600 KB Output is correct
8 Correct 57 ms 856 KB Output is correct
9 Correct 107 ms 948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 401 ms 1532 KB Output is correct
2 Correct 828 ms 2248 KB Output is correct
3 Correct 1440 ms 2860 KB Output is correct
4 Execution timed out 2037 ms 3612 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1674 ms 3944 KB Output is correct
2 Execution timed out 2060 ms 4072 KB Time limit exceeded
3 Halted 0 ms 0 KB -