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

Envío 7179

Problema 0x9b - Máximo elemento en un subarreglo pequeño

  • Autor: ppastram
  • Fecha: 2023-10-20 14:05:14 UTC (Hace alrededor de 1 año)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#2
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#3
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#4
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#5
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#6
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#7
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#8
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#9
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#10
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#11
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#12
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
#13
Error de compilación
                      main.cpp:10:5: error: use of undeclared identifier 'vector'
    vector <int> lista;
    ^
main.cpp:10:16: error: expected '(' for function-style cast or type construction
    vector <int> lista;
            ~~~^
main.cpp:10:18: error: use of undeclared identifier 'lista'
    vector <int> lista;
                 ^
main.cpp:15:9: error: use of undeclared identifier 'lista'
        lista.push_back(este);
        ^
main.cpp:26:16: error: use of undeclared identifier 'lista'
            if(lista[i] > mayor)
               ^
main.cpp:28:25: error: use of undeclared identifier 'lista'
                mayor = lista[i];
                        ^
6 errors generated.

                    
Puntos totales: 0 / 100

Código

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int n, c, este, l, r;
    cin >> n;
    vector <int> lista;

    while(n--)
    {
        cin >> este;
        lista.push_back(este);
    }

    cin >> c;
    while(c--)
    {
        cin >> l >> r;
        int mayor, indice;
        mayor = 0;
        for(int i = l; i <= r; i++)
        {
            if(lista[i] > mayor)
            {
                mayor = lista[i];
                indice = i;
            }
        }
        cout << indice << endl;
    }
}