Submit Info #68244

Problem Lang User Status Time Memory
Static Range Sum cpp (anonymous) AC 161 ms 11.48 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 149 ms 11.45 MiB
max_random_01 AC 151 ms 11.48 MiB
max_random_02 AC 161 ms 11.43 MiB
max_random_03 AC 151 ms 11.45 MiB
max_random_04 AC 149 ms 11.44 MiB
random_00 AC 121 ms 9.30 MiB
random_01 AC 133 ms 9.95 MiB
random_02 AC 76 ms 5.95 MiB
random_03 AC 43 ms 4.00 MiB
random_04 AC 44 ms 3.84 MiB

#include<bits/stdc++.h> #define ll long long int #define pb push_back #define pf push_front #define F first #define S second #define sonic ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const ll MAXV=5e5+50; ll pref[MAXV]; int main() { sonic ll n,q,a; cin>>n>>q; for(ll i=1; i<=n; i++) { cin>>a; pref[i]=pref[i-1]+a; } ll l,r; while(q--) { cin>>l>>r; cout<<pref[r]-pref[l]<<'\n'; } }