Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.005 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Incorrecto
|
0.005 s | 1 KBi |
#5 |
Incorrecto
|
0.006 s | 1 KBi |
#6 |
Incorrecto
|
0.006 s | 1 KBi |
#7 |
Incorrecto
|
0.005 s | 1 KBi |
#8 |
Incorrecto
|
0.031 s | 1 KBi |
#9 |
Incorrecto
|
0.106 s | 1 KBi |
#10 |
Incorrecto
|
0.115 s | 2 KBi |
#11 |
Incorrecto
|
0.162 s | 1 KBi |
#12 |
Incorrecto
|
0.106 s | 2 KBi |
#13 |
Incorrecto
|
0.126 s | 2 KBi |
#14 |
Incorrecto
|
0.144 s | 1 KBi |
#include <iostream> #include <climits> using namespace std; int main() { int n; cin>>n; int arr[n]; int sums[n]; for(int i = 0; i < n; i++) { cin>>arr[i]; } for(int i = 1; i < n; i++) { arr[i] += arr[i - 1]; } int c; cin>>c; int results[c]; for(int i = 0; i < c; i++) { int p, q; cin>>p>>q; if(p == 0) results[i] = sums[q]; else results[i] = sums[q] - sums[p - 1]; } for(int i = 0; i < c; i++) { cout<<results[i]<<endl; } return 0; }