Submit Info #66474

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

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 624 ms 15.32 MiB
max_random_01 AC 635 ms 15.33 MiB
max_random_02 AC 646 ms 15.32 MiB
max_random_03 AC 649 ms 15.27 MiB
max_random_04 AC 670 ms 15.32 MiB
random_00 AC 546 ms 12.25 MiB
random_01 AC 550 ms 13.39 MiB
random_02 AC 368 ms 6.32 MiB
random_03 AC 140 ms 7.25 MiB
random_04 AC 170 ms 6.00 MiB

#include <bits/stdc++.h> using namespace std; int main() { int length; cin>>length; int times; cin>>times; long long numbers[length]; long long psa[length]; cin>>numbers[0]; psa[0] = numbers[0]; for (int i = 1; i < length; i++) { cin>>numbers[i]; psa[i] = psa[i - 1] + numbers[i]; } for (int i = 0; i < times; i++) { int a, b; cin>>a>>b; if (a != 0) cout<<(psa[b - 1] - psa[a - 1])<<endl; else cout<<psa[b - 1]<<endl; } }