Submit Info #65235

Problem Lang User Status Time Memory
Static Range Sum cpp14 (anonymous) AC 151 ms 15.35 MiB

Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 149 ms 15.35 MiB
max_random_01 AC 149 ms 15.27 MiB
max_random_02 AC 149 ms 15.32 MiB
max_random_03 AC 151 ms 15.32 MiB
max_random_04 AC 149 ms 15.35 MiB
random_00 AC 120 ms 12.29 MiB
random_01 AC 127 ms 13.45 MiB
random_02 AC 76 ms 6.39 MiB
random_03 AC 43 ms 7.27 MiB
random_04 AC 45 ms 6.07 MiB

//Today's thought: Push yourself,because no one else is going to do it for you. // "Once you decide your lifes purpose, you will only have to pack one thing: "Your Heart." #include <bits/stdc++.h> #define endl "\n" #define ll long long int #define vi vector<int> #define vll vector<ll> #define vvi vector < vi > #define pii pair<int,int> #define pll pair<long long, long long> #define mod 1000000007 #define inf 1000000000000000001; #define all(c) c.begin(),c.end() #define mp(x,y) make_pair(x,y) #define mem(a,val) memset(a,val,sizeof(a)) #define eb emplace_back #define f first #define s second #define pb push_back // important h using namespace std; void solve() { ll n,q; cin>>n>>q; ll a[n],prefix[n+1]={0}; for(int i=1;i<n+1;i++) { cin>>a[i]; prefix[i]=prefix[i-1]+a[i]; } while(q--) { ll l,r; cin>>l>>r; cout<<prefix[r]-prefix[l]<<endl; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // int t; // cin>>t; // while(t--) // { solve(); //} }