Solution
1646-Static_Range_Sum_Queries.cpp
1#include<bits/stdc++.h>
2using namespace std;
3#define int long long
4signed main(){
5 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
6 int n,q; cin>>n>>q;
7 int a[n+1];a[0]=0;
8 for(int i=1;i<=n;++i){
9 cin>>a[i];
10 a[i]+=a[i-1];
11 }
12 while(q--){
13 int l,r; cin>>l>>r;
14 cout<<a[r]-a[l-1]<<'\n';
15 }
16 return 0;
17}Editorial not yet generated for this problem. Run the editorial generation script to add hints and detailed explanations.