█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 2214

Problema 0x25 - Suma de un subarreglo grande

  • Autor: tristanjs
  • Fecha: 2020-12-06 02:14:11 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.006 s 2 KBi
#2
Correcto
0.006 s 2 KBi
#3
Correcto
0.006 s 1 KBi
#4
Correcto
0.006 s 2 KBi
#5
Correcto
0.005 s 1 KBi
#6
Correcto
0.006 s 2 KBi
#7
Correcto
0.007 s 2 KBi
#8
Correcto
0.527 s 2 KBi
#9
Tiempo límite excedido
1.079 s 1 KBi
#10
Tiempo límite excedido
1.057 s 2 KBi
#11
Tiempo límite excedido
1.062 s 2 KBi
#12
Tiempo límite excedido
1.023 s 2 KBi
#13
Correcto
0.268 s 2 KBi
#14
Tiempo límite excedido
1.041 s 2 KBi
Puntos totales: 65 / 100

Código

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int tam, a, b, query, cont;
    vector <int> numbers;
    cin >> tam;
    while( tam-- ){
        cin >> a;
        numbers.push_back(a);
    }

    cin >> query;
    while ( query-- ){
        cin >> a >> b;
        cont=0;
        for(int i=a;i<=b;i++){
            cont += numbers[i];
        }
        cout << cont << endl;
    }
    return 0;
}