Submission #1038390

# Submission time Handle Problem Language Result Execution time Memory
1038390 2024-07-29T18:32:38 Z tarpent Addk (eJOI21_addk) C++14
92 / 100
993 ms 5196 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e5+7;
ll n,k,q,tre,tz,l,r,m;
ll pre[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>n>>k;
	for(ll i = 0; i<n; i++){
		cin>>tre;
		pre[i+1]=pre[i]+tre;
	}
	cin>>q;
	for(ll i = 0;i<q; i++){
		cin>>tre;
		if(tre==1){
			cin>>l;
		}
		else{
			cin>>l>>r>>m;
			ll od = 0;
			
			int f = min(m,(r-l+1)-m+1);
			for(ll p = 0; p<f; p++){
				od+=pre[r]-pre[l-1];
				r--;
				l++;
			}
			cout<<od<<'\n';
		}		
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
6 Correct 5 ms 604 KB Output is correct
7 Correct 6 ms 596 KB Output is correct
8 Correct 8 ms 592 KB Output is correct
9 Correct 15 ms 868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 1616 KB Output is correct
2 Correct 114 ms 1752 KB Output is correct
3 Correct 193 ms 2128 KB Output is correct
4 Correct 644 ms 3648 KB Output is correct
5 Correct 993 ms 5196 KB Output is correct
6 Correct 885 ms 4720 KB Output is correct
7 Correct 761 ms 4852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 2388 KB Output isn't correct
2 Halted 0 ms 0 KB -