Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Error en tiempo de ejecución (NZEC)
Exited with error status 134 munmap_chunk(): invalid pointer run: line 1: 3 Aborted (core dumped) ./a.out |
0.005 s | 1 KBi |
#3 |
Error en tiempo de ejecución (NZEC)
Exited with error status 134 free(): invalid pointer run: line 1: 3 Aborted (core dumped) ./a.out |
0.005 s | 1 KBi |
#4 |
Error en tiempo de ejecución (NZEC)
Exited with error status 134 free(): invalid pointer run: line 1: 3 Aborted (core dumped) ./a.out |
0.005 s | 2 KBi |
#5 |
Correcto
|
0.006 s | 63 KBi |
#6 |
Correcto
|
0.005 s | 2 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.019 s | 1 KBi |
#9 |
Correcto
|
0.036 s | 1 KBi |
#10 |
Correcto
|
0.033 s | 1 KBi |
#11 |
Correcto
|
0.033 s | 1 KBi |
#12 |
Correcto
|
0.029 s | 2 KBi |
#13 |
Correcto
|
0.034 s | 1 KBi |
#14 |
Correcto
|
0.044 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; int main(void) { long lenght, sum = 0, p, q; cin >> lenght; vector<int> arr(lenght), arrsum(lenght); for (long i = 0; i < lenght; i++) { cin >> arr[i]; sum += arr[i]; arrsum[i] = sum; } cin >> lenght; for (long i = 0; i < lenght; i++) { cin >> p; cin >> q; arr[i] = arrsum[q]; if (p > 0) arr[i] = arrsum[q] - arrsum[p - 1]; } for (long i = 0; i < lenght; i++) cout << arr[i] << endl; return 0; }