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

Envío 1128

Problema 0xcf - Mirando al horizonte

  • Autor: juantamayo26
  • Fecha: 2020-10-11 00:29:31 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.005 s 1 KBi
#2
Incorrecto
0.005 s 2 KBi
#3
Correcto
0.005 s 6 KBi
#4
Correcto
0.005 s 2 KBi
#5
Incorrecto
0.005 s 9 KBi
#6
Incorrecto
0.069 s 6 KBi
#7
Correcto
0.077 s 6 KBi
#8
Correcto
0.089 s 5 KBi
#9
Incorrecto
0.072 s 27 KBi
#10
Incorrecto
0.094 s 24 KBi
Puntos totales: 50 / 100

Código

#include <iostream>

using namespace std;

#define endl '\n'
#define ll long long
int a[500100];
int ans[500100];

int main(){
  ios::sync_with_stdio(0); cin.tie(0); 
  int t;
  cin>>t;
  for(int j=1; j<=t; j++){
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
      cin>>a[i];
    }
    int aux=a[n];
    ans[n] = -1;
    for(int i=n-1; i>0; i--){
      if(aux<=a[i]){
        ans[i]=-1;
        aux=a[i];
      }else{
        ans[i]=aux;
      }
    }
    cout<<"Case #"<<j<<": ";
    for(int i=1; i<=n; i++){
      cout<<ans[i]<<" ";
    }
    cout<<endl;
  }
}