Submit Info #66179

Problem Lang User Status Time Memory
Static Range Sum cpp14 (anonymous) AC 674 ms 15.32 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.42 MiB
max_random_00 AC 644 ms 15.26 MiB
max_random_01 AC 660 ms 15.32 MiB
max_random_02 AC 661 ms 15.25 MiB
max_random_03 AC 674 ms 15.32 MiB
max_random_04 AC 657 ms 15.32 MiB
random_00 AC 535 ms 12.29 MiB
random_01 AC 537 ms 13.47 MiB
random_02 AC 389 ms 6.33 MiB
random_03 AC 142 ms 7.21 MiB
random_04 AC 178 ms 6.02 MiB

#include <iostream> #include <fstream> #include <bits/stdc++.h> using namespace std; using ll = long long; int main() { //ifstream cin("inputs.txt"); int n; cin >> n; int q; cin >> q; ll seq[n]; for(int i = 0; i < n; i++) { cin >> seq[i]; } ll prefix[n + 1]; prefix[0] = 0; for(int i = 1; i < n + 1; i++) { prefix[i] = prefix[i - 1] + seq[i - 1]; } for(int i = 0; i < q; i++) { int l; cin >> l; int r; cin >> r; cout << prefix[r] - prefix[l] << "\n"; } }