Submit Info #66550

Problem Lang User Status Time Memory
Static Range Sum cpp JacobDDoS AC 151 ms 11.54 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 151 ms 11.54 MiB
max_random_01 AC 143 ms 11.53 MiB
max_random_02 AC 141 ms 11.54 MiB
max_random_03 AC 141 ms 11.53 MiB
max_random_04 AC 146 ms 11.45 MiB
random_00 AC 115 ms 9.32 MiB
random_01 AC 120 ms 9.87 MiB
random_02 AC 73 ms 6.04 MiB
random_03 AC 37 ms 4.07 MiB
random_04 AC 41 ms 3.92 MiB

#include <bits/stdc++.h> typedef unsigned long long ull; typedef long long ll; typedef long double ld; using namespace std; void solve() { int n, q; cin >> n >> q; ull nums[n]; cin >> nums[0]; for (int i=1;i<n;i++) { int t; cin >> t; nums[i] = nums[i-1] + t; } for (int i=0;i<q;i++) { int a, b; cin >> a >> b; if (a==0) { cout << nums[b-1] << '\n'; } else { cout << nums[b-1]-nums[a-1] << '\n'; } } return; } int main() { ios::sync_with_stdio(0); cin.tie(0); // freopen("blocks.in", "r", stdin); // freopen("blocks.out", "w", stdout); solve(); // int t; // cin >> t; // while (t--) { // solve(); // } }