Submit Info #66506

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

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 632 ms 13.32 MiB
max_random_01 AC 634 ms 13.38 MiB
max_random_02 AC 631 ms 13.32 MiB
max_random_03 AC 624 ms 13.31 MiB
max_random_04 AC 632 ms 13.43 MiB
random_00 AC 525 ms 10.77 MiB
random_01 AC 547 ms 11.68 MiB
random_02 AC 367 ms 6.20 MiB
random_03 AC 133 ms 5.63 MiB
random_04 AC 168 ms 4.98 MiB

#include <bits/stdc++.h> #define maxn 500005 using namespace std; int n, q, l, r, a[maxn]; long long b[maxn]; int main() { cin >> n >> q; for (int i = 1; i <= n; i++){ cin >> a[i]; b[i] = b[i-1]+a[i]; } while (q--){ cin >> l >> r; cout << b[r]-b[l] << endl; } return 0; }