Submit Info #65920

Problem Lang User Status Time Memory
Static Range Sum cpp tardigrade AC 447 ms 15.36 MiB

ケース詳細
Name Status Time Memory
example_00 AC 1 ms 0.45 MiB
max_random_00 AC 429 ms 15.31 MiB
max_random_01 AC 441 ms 15.32 MiB
max_random_02 AC 433 ms 15.36 MiB
max_random_03 AC 447 ms 15.31 MiB
max_random_04 AC 419 ms 15.36 MiB
random_00 AC 348 ms 12.23 MiB
random_01 AC 351 ms 13.45 MiB
random_02 AC 278 ms 6.36 MiB
random_03 AC 58 ms 7.27 MiB
random_04 AC 99 ms 6.07 MiB

#include <bits/stdc++.h> #define fi first #define se second #define rep(i,s,n) for (int i = (s); i < (n); ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define len(x) (int)(x).size() #define pb push_back #define em emplace_back #define vi vector<int> #define vl vector<long long> #define vs vector<string> #define vc vector<char> #define vd vector<double> #define vb vector<bool> #define vvi vector<vector<int>> #define vvl vector<vector<long long>> #define fast \ cin.tie(0); \ ios::sync_with_stdio(false); using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; int main() { fast int n,q; cin >> n >> q; vl a(n),b(n); rep(i,0,n) cin >> a[i]; rep(i,0,n) b[i+1] = a[i]+b[i]; rep(i,0,q){ int u,v; cin >> u >> v; cout << b[v]-b[u] << endl; } return 0; }