Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Incorrecto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.006 s | 1 KBi |
#4 |
Correcto
|
0.006 s | 1 KBi |
#5 |
Incorrecto
|
0.006 s | 1 KBi |
#6 |
Incorrecto
|
0.135 s | 9 KBi |
#7 |
Correcto
|
0.119 s | 9 KBi |
#8 |
Correcto
|
0.244 s | 9 KBi |
#9 |
Incorrecto
|
0.137 s | 9 KBi |
#10 |
Incorrecto
|
0.201 s | 11 KBi |
#include <iostream> using namespace std; int main() { int c; cin >> c; for (int k = 1; k <= c; k++) { int n; cin >> n; long values[n]; for (int i = 0; i < n; i++) { cin >> values[i]; } long current = -1e9; long response[n]; for (int i = n - 1; i >= 0; i--) { if (values[i] >= current) { response[i] = -1; current = values[i]; } else { response[i] = current; } } cout << "Case #" << k << ": "; for (int i = 0; i < n - 1; i++) { cout << response[i] << " "; } cout << response[n - 1] << endl; } return 0; }