Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.167 s | 16 KBi |
#2 |
Incorrecto
|
0.151 s | 12 KBi |
#3 |
Correcto
|
0.173 s | 17 KBi |
#4 |
Correcto
|
0.135 s | 11 KBi |
#5 |
Incorrecto
|
0.142 s | 12 KBi |
#6 |
Tiempo límite excedido
|
0.872 s | 125 KBi |
#7 |
Tiempo límite excedido
|
1.037 s | 125 KBi |
#8 |
Tiempo límite excedido
|
1.046 s | 125 KBi |
#9 |
Tiempo límite excedido
|
0.993 s | 125 KBi |
#10 |
Tiempo límite excedido
|
1.078 s | 125 KBi |
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(in.readLine()), C = 1; while (N-- > 0) { int s = Integer.parseInt(in.readLine()); int[] v = new int[s]; StringTokenizer st = new StringTokenizer(in.readLine()); for (int i = 0; i < s; ++i) { v[i] = Integer.parseInt(st.nextToken()); } int max = v[s - 1]; String sol = "-1"; for (int i = s - 2; i >= 0; --i) { if (v[i] < max) { sol = max + " " + sol; } else { sol = -1 + " " + sol; } max = Math.max(max, v[i]); } System.out.println("Case #" + (C++) + ": " + sol); } } }