Submit Info #67072

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

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.41 MiB
max_random_00 AC 632 ms 11.45 MiB
max_random_01 AC 640 ms 11.51 MiB
max_random_02 AC 623 ms 11.51 MiB
max_random_03 AC 630 ms 11.45 MiB
max_random_04 AC 629 ms 11.51 MiB
random_00 AC 504 ms 9.25 MiB
random_01 AC 536 ms 9.86 MiB
random_02 AC 371 ms 6.00 MiB
random_03 AC 141 ms 3.97 MiB
random_04 AC 178 ms 3.93 MiB

#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int N, Q; cin >> N >> Q; vector<ll> A(N + 1, 0); for (int i = 0; i < N; i++) cin >> A[i + 1]; for (int i = 1; i < N + 1; i++) A[i] += A[i - 1]; int l, r; for (int i = 0; i < Q; i++) { cin >> l >> r; cout << A[r] - A[l] << endl; } return 0; }