답안 #501078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501078 2022-01-02T10:34:32 Z uncripted Addk (eJOI21_addk) C++11
36 / 100
2000 ms 2460 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,k;
	cin>>n>>k;
	long long a[n+1];
	for(long long i=1; i<=n; i++){
		cin>>a[i];
	}
	long long q;
	cin>>q;
	while(q--){
		long long x;
		cin>>x;
		if(x==1){
			int y;
			cin>>y;
			
			continue;
			
		}
		long long l,r,m;
		cin>>l>>r>>m;
		
		long long s=0;
		for(long long j=l; j<=r; j++){
		long long l1,r2;
			l1=max(j-m+1, l);
			r2=min(j+m-1, r);
			s+=a[j]*(r2-l1-m+2);
		}
		cout<<s<<endl;
	}
	
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 292 KB Output is correct
3 Correct 9 ms 364 KB Output is correct
4 Correct 16 ms 300 KB Output is correct
5 Correct 25 ms 428 KB Output is correct
6 Correct 36 ms 428 KB Output is correct
7 Correct 61 ms 480 KB Output is correct
8 Correct 71 ms 516 KB Output is correct
9 Correct 122 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 497 ms 692 KB Output is correct
2 Correct 969 ms 1612 KB Output is correct
3 Correct 1750 ms 2060 KB Output is correct
4 Execution timed out 2053 ms 2460 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 898 ms 1408 KB Output isn't correct
2 Halted 0 ms 0 KB -