Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.006 s | 3 KBi |
#3 |
Correcto
|
0.005 s | 3 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.008 s | 62 KBi |
#7 |
Correcto
|
0.007 s | 1 KBi |
#8 |
Correcto
|
0.031 s | 1 KBi |
#9 |
Correcto
|
0.176 s | 2 KBi |
#10 |
Correcto
|
0.149 s | 2 KBi |
#11 |
Correcto
|
0.158 s | 2 KBi |
#12 |
Correcto
|
0.142 s | 2 KBi |
#13 |
Correcto
|
0.146 s | 2 KBi |
#14 |
Correcto
|
0.163 s | 2 KBi |
#include <iostream> #include <vector> using namespace std; #define ll long long #define D(x) cout << #x << " " << x << endl int main() { ll n, q, ai, x, y; cin >> n; vector<ll> dp(n + 1); dp[0] = 0LL; cin >> dp[1]; for(int i = 2; i <= n; ++i) { cin >> ai; dp[i] = dp[i - 1] + ai; } cin >> q; while(q--) { cin >> x >> y; cout << dp[y + 1] - dp[x] << endl; } return 0; }