Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 2 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 3 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 61 KBi |
#8 |
Correcto
|
0.019 s | 1 KBi |
#9 |
Correcto
|
0.042 s | 2 KBi |
#10 |
Correcto
|
0.03 s | 1 KBi |
#11 |
Correcto
|
0.033 s | 1 KBi |
#12 |
Correcto
|
0.03 s | 1 KBi |
#13 |
Correcto
|
0.031 s | 1 KBi |
#14 |
Correcto
|
0.031 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; int main(void) { long lenght, a, sum = 0, p, q; cin >> lenght; vector<int> arr(lenght); for (long i = 0; i < lenght; i++) { cin >> a; sum += a; arr[i] = sum; } cin >> lenght; for (long i = 0; i < lenght; i++) { cin >> p; cin >> q; sum = arr[q]; if (p > 0) sum = arr[q] - arr[p - 1]; cout << sum << endl; } return 0; }