Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 2 KBi |
#2 |
Correcto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.004 s | 1 KBi |
#5 |
Correcto
|
0.006 s | 2 KBi |
#6 |
Error en tiempo de ejecución (NZEC)
Exited with error status 139 run: line 1: 3 Segmentation fault (core dumped) ./a.out |
0.015 s | 2 KBi |
#7 |
Error en tiempo de ejecución (NZEC)
Exited with error status 139 run: line 1: 3 Segmentation fault (core dumped) ./a.out |
0.012 s | 2 KBi |
#8 |
Error en tiempo de ejecución (NZEC)
Exited with error status 139 run: line 1: 3 Segmentation fault (core dumped) ./a.out |
0.018 s | 1 KBi |
#9 |
Error en tiempo de ejecución (NZEC)
Exited with error status 139 run: line 1: 3 Segmentation fault (core dumped) ./a.out |
0.009 s | 1 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 139 run: line 1: 3 Segmentation fault (core dumped) ./a.out |
0.017 s | 1 KBi |
#include <iostream> #include <vector> using namespace std; int main() { int cases, n; vector<int> a(n); vector<int> answer(n); cin >> cases; for (int c = 1; c <= cases; c++) { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = n - 1; i >= 0; i--) { int max_a = -1; for (int j = i; j < n; j++) { if (a[j] > a[i]) { max_a = a[j]; break; } } answer[i] = max_a; } cout << "Case #" << c << ":"; for (int i = 0; i < n; ++i) { cout << " " << answer[i]; } cout << endl; } return 0; }