Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.003 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.004 s | 1 KBi |
#8 |
Correcto
|
0.028 s | 1 KBi |
#9 |
Correcto
|
0.129 s | 1 KBi |
#10 |
Correcto
|
0.138 s | 2 KBi |
#11 |
Correcto
|
0.23 s | 2 KBi |
#12 |
Correcto
|
0.132 s | 2 KBi |
#13 |
Correcto
|
0.151 s | 2 KBi |
#14 |
Correcto
|
0.23 s | 2 KBi |
#include <iostream> using namespace std; int main() { int N; cin >> N; int array [N]; int sums[N]; int sum = 0; for(int i = 0;i<N;i++){ cin >> array[i] ; sum += array[i]; sums[i] = sum; } int c; cin >> c; for(int i = 0;i<c;i++){ int p,q; cin >> p; cin >> q; int result = sums[q]-sums[p]+array[p]; cout << result << endl; } return 0; }