Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.007 s | 54 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.108 s | 1 KBi |
#9 |
Correcto
|
0.38 s | 1 KBi |
#10 |
Correcto
|
0.399 s | 1 KBi |
#11 |
Correcto
|
0.396 s | 1 KBi |
#12 |
Correcto
|
0.366 s | 1 KBi |
#13 |
Correcto
|
0.398 s | 1 KBi |
#14 |
Correcto
|
0.368 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> arr = vector<int>(n); for(int i=0; i<n; i++){ cin >> arr[i]; } int m, p, q, sum; cin >> m; for(int i=0; i<m; i++){ cin >> p >> q; sum = 0; for(int j=p; j<=q; j++){ sum += arr[j]; } cout << sum << endl; } return 0; }