Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 28 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.008 s | 2 KBi |
#4 |
Correcto
|
0.006 s | 7 KBi |
#5 |
Correcto
|
0.008 s | 1 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 32 KBi |
#8 |
Correcto
|
0.054 s | 2 KBi |
#9 |
Correcto
|
0.304 s | 37 KBi |
#10 |
Correcto
|
0.222 s | 2 KBi |
#11 |
Correcto
|
0.22 s | 2 KBi |
#12 |
Correcto
|
0.21 s | 2 KBi |
#13 |
Correcto
|
0.219 s | 2 KBi |
#14 |
Correcto
|
0.306 s | 29 KBi |
#include<iostream> #include<vector> using namespace std; int main(){ int n,c; cin>>n; vector<int> vals(n); for(auto &val: vals){ cin>>val; } vector<int>acum(n); acum[0] = vals[0]; for(int i=1;i<acum.size();i++){ acum[i] = acum[i-1] + vals[i]; } cin>>c; for(int i=0;i<c;i++){ int p,q; cin>>p>>q; if(p==0){ cout<<acum[q]<<endl; } else{ cout<<acum[q]-acum[p-1]<<endl; } } return 0; }