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

Envío 2759

Problema 0xcf - Mirando al horizonte

  • Autor: pradomaricon
  • Fecha: 2021-02-04 06:11:06 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.007 s 38 KBi
#2
Incorrecto
0.006 s 22 KBi
#3
Incorrecto
0.007 s 5 KBi
#4
Incorrecto
0.007 s 2 KBi
#5
Incorrecto
0.007 s 1 KBi
#6
Tiempo límite excedido
1.055 s 7 KBi
#7
Tiempo límite excedido
1.044 s 13 KBi
#8
Tiempo límite excedido
1.065 s 7 KBi
#9
Tiempo límite excedido
1.064 s 7 KBi
#10
Tiempo límite excedido
1.058 s 7 KBi
Puntos totales: 0 / 100

Código

#include <iostream>
#include <vector>

using namespace std;
void  horizontes(int length,vector<int> a,vector<int> &soluc);
int main(){
    int numCases;
    cin >> numCases;
   
    
    for(int i=0;i<numCases;++i){
        int length;
        cin >> length;
        vector<int> a(length);
        vector<int> soluc(length);
        for(int j=0;j<length;j++){
            cin >> a[j];
        }
        horizontes(length,a,soluc);
        
        //printar
        cout << "Case #"<< i + 1 << ": ";
        for(int j=0;j<length;j++){
            cout << soluc[j];
        }
        cout << "\n";

    }
    
    
    
    
    
}

void horizontes(int length,vector<int> a, vector<int> &soluc){
    
    for(int k =0;k<length;k++){
        bool blocked = false;
        int j = k+1;
        while(!blocked && j<length+1){
            if(a[j]>a[k]){
                blocked = true;
                soluc[k]=a[j];
            }
            j++;
        }
        if(j==length+1){
            soluc[k]=-1;
        }
    }
    

}