답안 #475615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475615 2021-09-23T12:46:46 Z Tkesho Addk (eJOI21_addk) C++14
36 / 100
2000 ms 3256 KB
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

vector <ll> arr;

int main() {
	ll n, k, q;
	cin>>n>>k;
	arr.resize(n+1);
	
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	
	cin>>q;
	
	for(ll j=0;j<q;j++) {
		ll requestType;
		cin>>requestType;
		
		if(requestType == 2) {
			ll sum = 0, mainsum = 0, l, r, m;
			cin>>l>>r>>m;
			
			for(ll i=l;i<l+m;i++)
				sum += arr[i];
			mainsum += sum;
			
			for(ll i=l+m;i<=r;i++) {
				sum += arr[i]-arr[i-m];
				mainsum += sum;
			}
			
			cout<<mainsum<<'\n';
		} else {
			// we could use fanwick three
			for(int i=0;i<k;i++)
			{
				ll tmp;
				cin>>tmp;
			}
			continue;
		}
	}
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 4 ms 320 KB Output is correct
3 Correct 8 ms 332 KB Output is correct
4 Correct 13 ms 388 KB Output is correct
5 Correct 19 ms 448 KB Output is correct
6 Correct 30 ms 460 KB Output is correct
7 Correct 34 ms 464 KB Output is correct
8 Correct 59 ms 436 KB Output is correct
9 Correct 108 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 254 ms 952 KB Output is correct
2 Correct 535 ms 1368 KB Output is correct
3 Correct 964 ms 1952 KB Output is correct
4 Execution timed out 2063 ms 2596 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1205 ms 3256 KB Output isn't correct
2 Halted 0 ms 0 KB -