Submit Info #65882

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

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.41 MiB
max_random_00 AC 659 ms 11.45 MiB
max_random_01 AC 653 ms 11.52 MiB
max_random_02 AC 659 ms 11.51 MiB
max_random_03 AC 665 ms 11.45 MiB
max_random_04 AC 662 ms 11.45 MiB
random_00 AC 534 ms 9.25 MiB
random_01 AC 556 ms 9.86 MiB
random_02 AC 375 ms 5.99 MiB
random_03 AC 141 ms 3.96 MiB
random_04 AC 179 ms 3.89 MiB

#include <iostream> #include <vector> using namespace std; int main() { int n, q; cin >> n >> q; vector<long long> v(n+1); v[0] = 0; for (int i = 1; i <= n; i++) { long long x; cin >> x; v[i] = v[i - 1] + x; } for (int i = 0; i < q; i++) { int l, r; cin >> l >> r; cout << v[r] - v[l] << "\n"; } }