Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 2 KBi |
#2 |
Correcto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.007 s | 2 KBi |
#4 |
Correcto
|
0.006 s | 1 KBi |
#5 |
Correcto
|
0.007 s | 1 KBi |
#6 |
Correcto
|
0.008 s | 1 KBi |
#7 |
Correcto
|
0.006 s | 2 KBi |
#8 |
Correcto
|
0.058 s | 2 KBi |
#9 |
Correcto
|
0.286 s | 2 KBi |
#10 |
Correcto
|
0.284 s | 1 KBi |
#11 |
Correcto
|
0.241 s | 2 KBi |
#12 |
Correcto
|
0.293 s | 2 KBi |
#13 |
Correcto
|
0.248 s | 2 KBi |
#14 |
Correcto
|
0.241 s | 2 KBi |
#include<iostream> using namespace std; int main(){ long n,c,p,q,aux=0; cin>>n; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; aux+=arr[i]; arr[i] = aux; } cin>>c; for(int i=0;i<c;i++){ cin>>p>>q; long answer; if(p==0){ answer = arr[q]; }else{ answer = arr[q]-arr[p-1]; } cout<<answer<<endl; } }