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

Envío 1371

Problema 0xcf - Mirando al horizonte

  • Autor: judavid.arias
  • Fecha: 2020-10-24 00:36:56 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.005 s 2 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.005 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.005 s 1 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.005 s 10 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.005 s 1 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.145 s 18 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.131 s 21 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.239 s 17 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.145 s 20 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 134
free(): invalid pointer
run: line 1:     3 Aborted                 (core dumped) ./a.out
0.197 s 19 KBi
Puntos totales: 0 / 100

Código

#include <iostream>
#include <algorithm>    // std::max
#include <bits/stdc++.h>
#include <list>
using namespace std;

int main()
{
	int c;
	cin >> c;
	for(int i = 0;i<c;i++){
		int N;
		cin >> N;
		int array[N];
		int solve[N];
		for(int i = 0;i<N;i++)
		{
			cin >> array[i];
		}
		list<int> l(N);
		
		for(int i = N-1;i>=0;i--){
			if(l.size() > 0 ){
				while(array[i]>=l.front()){
					l.pop_front();
				}
				
				if(l.size() == 0){
					solve[i] = -1;
					l.push_front(array[i]);
				}else{
					solve[i] = l.front();
					l.push_front(array[i]);
				}
				
			}else{
					solve[i] = -1;
					l.push_front(array[i]);
			}
			
		}
		
		for(int i = 0;i<N;i++)
			cout << solve[i] << " ";
		
		
	}
	

	
	
	
	
	
	

	return 0;
	
	
}