Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 2 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.003 s | 0 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.006 s | 2 KBi |
#6 |
Correcto
|
0.003 s | 0 KBi |
#7 |
Correcto
|
0.004 s | 1 KBi |
#8 |
Correcto
|
0.007 s | 2 KBi |
#9 |
Correcto
|
0.025 s | 2 KBi |
#10 |
Correcto
|
0.019 s | 2 KBi |
#11 |
Correcto
|
0.024 s | 2 KBi |
#12 |
Correcto
|
0.023 s | 3 KBi |
#13 |
Correcto
|
0.02 s | 1 KBi |
#14 |
Correcto
|
0.024 s | 2 KBi |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define sz(x) int(x.size()) #define dbg(x) cout << #x << " = " << x << endl int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; ll val[n + 1]; val[0] = 0; for (int i = 1; i <= n; ++i) { cin >> val[i]; val[i] += val[i - 1]; } int q; cin >> q; while (q--) { int a, b; cin >> a >> b; cout << val[b + 1] - val[a] << endl; } return 0; }