Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 3 KBi |
#5 |
Correcto
|
0.006 s | 13 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.033 s | 2 KBi |
#9 |
Correcto
|
0.144 s | 4 KBi |
#10 |
Correcto
|
0.135 s | 2 KBi |
#11 |
Correcto
|
0.145 s | 2 KBi |
#12 |
Correcto
|
0.145 s | 2 KBi |
#13 |
Correcto
|
0.159 s | 1 KBi |
#14 |
Correcto
|
0.155 s | 1 KBi |
#include<iostream> using namespace std; int a[50001]; int p[50001]; int main(){ int n; cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; p[i]= a[i]+p[i-1]; } int c; cin>>c; while(c--){ int x,b,ans=0; cin>>x>>b; x++; b++; ans = p[b]-p[x-1]; cout<<ans<<endl; } return 0; }