Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.006 s | 2 KBi |
#3 |
Correcto
|
0.007 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 2 KBi |
#5 |
Correcto
|
0.005 s | 2 KBi |
#6 |
Correcto
|
0.008 s | 2 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.055 s | 2 KBi |
#9 |
Correcto
|
0.255 s | 2 KBi |
#10 |
Correcto
|
0.225 s | 2 KBi |
#11 |
Correcto
|
0.279 s | 2 KBi |
#12 |
Correcto
|
0.232 s | 2 KBi |
#13 |
Correcto
|
0.279 s | 2 KBi |
#14 |
Correcto
|
0.284 s | 2 KBi |
#include <bits/stdc++.h> using namespace std; int main() { int cases, x, sum = 0; cin >> cases; vector <int> numbers; vector <int> sum_num; while( cases-- ){ cin >> x; numbers.push_back(x); sum += x; sum_num.push_back(sum); } int consulta,a,b,ans; cin >> consulta; while( consulta-- ){ cin >> a >> b; ans = sum_num[b]; if(a > 0){ ans -= sum_num[a-1]; } cout << ans << endl; } return 0; }