Submit Info #65233

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

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 161 ms 11.45 MiB
max_random_01 AC 155 ms 11.53 MiB
max_random_02 AC 152 ms 11.49 MiB
max_random_03 AC 164 ms 11.53 MiB
max_random_04 AC 155 ms 11.52 MiB
random_00 AC 123 ms 9.30 MiB
random_01 AC 127 ms 9.95 MiB
random_02 AC 76 ms 6.01 MiB
random_03 AC 42 ms 3.99 MiB
random_04 AC 44 ms 3.93 MiB

#include <bits/stdc++.h> using namespace std; #define int long long #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); signed main(){ IOS int n, q; cin >> n >> q; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; if(i) a[i] += a[i-1]; } while(q--) { int l, r; cin >> l >> r; if(l) cout << a[r-1] - a[l-1] << "\n"; else cout << a[r-1] << "\n"; } return 0; }