답안 #787828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787828 2023-07-19T13:03:35 Z ThylOne Addk (eJOI21_addk) C++14
36 / 100
2000 ms 3440 KB
#include<bits/stdc++.h>
 
using namespace std;
#define int long long
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,q,k;cin>>n>>k;
	vector<int> nums(n);
	for(int i = 0;i<n;i++){
		cin>>nums[i];
	}
	cin>>q;
	for(int _ = 0 ; _ <q;_++){
		int type;cin>>type;
		if(type==1){
			vector<int> rotates(k);
			for(int i = 0;i<k;i++){
				cin>>rotates[i];
			}
		}else{
			int a,b,m;
			cin>>a>>b>>m;
			a--;
			b--;
			int ans = 0;
			int sum=0;
			for(int i = a ; i <a+m;i++){
				sum+=nums[i];
				}
			ans+=sum;
			for(int i = a+m ; i <= b;i++){
				sum-=nums[i-m];
				sum+=nums[i];

				ans+=sum;
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 328 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 8 ms 440 KB Output is correct
5 Correct 13 ms 472 KB Output is correct
6 Correct 17 ms 488 KB Output is correct
7 Correct 30 ms 516 KB Output is correct
8 Correct 30 ms 568 KB Output is correct
9 Correct 53 ms 664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 183 ms 1188 KB Output is correct
2 Correct 405 ms 1676 KB Output is correct
3 Correct 693 ms 2140 KB Output is correct
4 Execution timed out 2062 ms 3440 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 831 ms 3108 KB Output isn't correct
2 Halted 0 ms 0 KB -