Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.024 s | 1 KBi |
#9 |
Correcto
|
0.163 s | 2 KBi |
#10 |
Correcto
|
0.135 s | 2 KBi |
#11 |
Correcto
|
0.157 s | 2 KBi |
#12 |
Correcto
|
0.124 s | 2 KBi |
#13 |
Correcto
|
0.142 s | 2 KBi |
#14 |
Correcto
|
0.111 s | 2 KBi |
#include <iostream> #include <climits> using namespace std; int main() { int n; cin>>n; int arr[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] = arr[q]; else results[i] = arr[q] - arr[p - 1]; } for(int i = 0; i < c; i++) { cout<<results[i]<<endl; } return 0; }