Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Correcto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 2 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.018 s | 1 KBi |
#9 |
Correcto
|
0.033 s | 1 KBi |
#10 |
Correcto
|
0.039 s | 1 KBi |
#11 |
Correcto
|
0.032 s | 1 KBi |
#12 |
Correcto
|
0.032 s | 2 KBi |
#13 |
Correcto
|
0.034 s | 1 KBi |
#14 |
Correcto
|
0.032 s | 4 KBi |
#include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<long> S(N); long sum = 0; for (int i = 0; i < N; ++i) { int Ai; cin >> Ai; sum += Ai; S[i] = sum; } int C; cin >> C; int p; int q; for (int i = 0; i < C; ++i) { cin >> p; cin >> q; long total = S[q]; if (p > 0) { total -= S[p - 1]; } cout << total << endl; } }