Submit Info #67884

Problem Lang User Status Time Memory
Static Range Sum cpp Hargun02 AC 650 ms 15.33 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.42 MiB
max_random_00 AC 650 ms 15.33 MiB
max_random_01 AC 633 ms 15.32 MiB
max_random_02 AC 633 ms 15.33 MiB
max_random_03 AC 632 ms 15.29 MiB
max_random_04 AC 641 ms 15.33 MiB
random_00 AC 511 ms 12.20 MiB
random_01 AC 543 ms 13.38 MiB
random_02 AC 382 ms 6.36 MiB
random_03 AC 140 ms 7.25 MiB
random_04 AC 179 ms 6.00 MiB

#include <bits/stdc++.h> using namespace std; int main(){ int n, q, l, r; cin >> n >> q; long long v[n+1], p[n+1]; v[n] = p[n] = 0; for(int i = 1; i <= n; i++){ cin >> v[i]; p[i] = p[i-1] + v[i]; } for(int i = 0; i < q; i++){ cin >> l >> r; cout << p[r] - p[l] << "\n"; } }