Submit Info #65728

Problem Lang User Status Time Memory
Static Range Sum cpp14 divad AC 653 ms 15.32 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 635 ms 15.32 MiB
max_random_01 AC 644 ms 15.32 MiB
max_random_02 AC 653 ms 15.29 MiB
max_random_03 AC 637 ms 15.23 MiB
max_random_04 AC 640 ms 15.21 MiB
random_00 AC 517 ms 12.28 MiB
random_01 AC 538 ms 13.38 MiB
random_02 AC 380 ms 6.42 MiB
random_03 AC 141 ms 7.29 MiB
random_04 AC 173 ms 5.95 MiB

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