답안 #541193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541193 2022-03-22T16:57:42 Z Fidan Addk (eJOI21_addk) C++17
36 / 100
2000 ms 3620 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N = 1000'010;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, k, i;
	cin>>n>>k;
	vector<ll> v(n);
	for(i=0; i<n; i++){
		cin>>v[i];
	}
	ll q;
	cin>>q;
	while(q--){
		ll t;
		cin>>t;
		if(t==1){
			for(i=0; i<k; i++){
				ll x1;
				cin>>x1;
			}
		}
		else {
			ll l, r, m, s=0, sum=0;
			cin>>l>>r>>m;
			l--, r--;
			for(i=l; i<l+m; i++){
				sum+=v[i];
			}
			s+=sum;
			for(i=l+1; i<=r-m+1; i++){
				sum-=v[i-1];
				sum+=v[i+m-1];
				s+=sum;
			}
			cout<<s<<endl;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 9 ms 436 KB Output is correct
5 Correct 13 ms 476 KB Output is correct
6 Correct 20 ms 488 KB Output is correct
7 Correct 25 ms 512 KB Output is correct
8 Correct 32 ms 568 KB Output is correct
9 Correct 59 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 203 ms 1132 KB Output is correct
2 Correct 432 ms 1716 KB Output is correct
3 Correct 746 ms 2260 KB Output is correct
4 Execution timed out 2076 ms 3620 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 886 ms 3208 KB Output isn't correct
2 Halted 0 ms 0 KB -