Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 2 KBi |
#2 |
Incorrecto
|
0.007 s | 2 KBi |
#3 |
Correcto
|
0.005 s | 2 KBi |
#4 |
Correcto
|
0.006 s | 2 KBi |
#5 |
Incorrecto
|
0.007 s | 1 KBi |
#6 |
Incorrecto
|
0.184 s | 7 KBi |
#7 |
Correcto
|
0.236 s | 6 KBi |
#8 |
Correcto
|
0.264 s | 6 KBi |
#9 |
Incorrecto
|
0.246 s | 6 KBi |
#10 |
Incorrecto
|
0.239 s | 8 KBi |
#include<bits/stdc++.h> using namespace std; #define optimizar_io ios_base::sync_with_stdio(0); cin.tie(0); #define fore(i, a, b) for(int i = a; i < b; i++) #define fori(i, a, b) for(int i = a; i <= b; i++) #define all(a) a.begin(),a.end() #define pb push_back #define popb pop_back #define mk make_pair #define fi first #define se second #define endl '\n' #define MAX 200 typedef long long int lli; typedef long double ld; int main() { int cases, n, tam, ii=1; cin >> cases; while(cases--){ cin >> tam; vector<int> numbers; while(tam--){ cin >> n; numbers.push_back(n); } int aux = 0; int asnwer[numbers.size()+1]; for (int i=numbers.size()-1;i>=0;i--){ if(numbers[i] >= aux){ aux = numbers[i]; asnwer[i] = -1; } else { asnwer[i] = aux; } } cout << "Case #" << (ii++) << ": "; for(int i=0;i<numbers.size();i++){ if(i+1 == numbers.size()) cout << asnwer[i] << endl; else cout << asnwer[i] << " "; } } return 0; }