Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 10 KBi |
#2 |
Correcto
|
0.005 s | 4 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.006 s | 2 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.031 s | 1 KBi |
#9 |
Correcto
|
0.149 s | 2 KBi |
#10 |
Correcto
|
0.155 s | 2 KBi |
#11 |
Correcto
|
0.153 s | 2 KBi |
#12 |
Correcto
|
0.148 s | 2 KBi |
#13 |
Correcto
|
0.158 s | 2 KBi |
#14 |
Correcto
|
0.164 s | 2 KBi |
#include <iostream> #include <vector> using namespace std; typedef long long ll; const int MAXN = 50005; int n, c, p, q; ll 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; }