Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 5 KBi |
#2 |
Correcto
|
0.007 s | 57 KBi |
#3 |
Correcto
|
0.006 s | 2 KBi |
#4 |
Correcto
|
0.006 s | 1 KBi |
#5 |
Correcto
|
0.006 s | 1 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.033 s | 2 KBi |
#9 |
Incorrecto
|
0.14 s | 2 KBi |
#10 |
Correcto
|
0.142 s | 2 KBi |
#11 |
Correcto
|
0.15 s | 1 KBi |
#12 |
Correcto
|
0.136 s | 1 KBi |
#13 |
Correcto
|
0.159 s | 1 KBi |
#14 |
Correcto
|
0.153 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; typedef long long ll; const int MAXN = 50005; int n, c, p, q; int sum[MAXN]; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> sum[i]; if (i > 0) sum[i] += sum[i - 1]; } cin >> c; while (c--) { cin >> p >> q; if (p > 0) cout << sum[q] - sum[p - 1]; else cout << sum[q]; cout << endl; } return 0; }