Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.005 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Incorrecto
|
0.005 s | 1 KBi |
#4 |
Incorrecto
|
0.006 s | 1 KBi |
#5 |
Incorrecto
|
0.005 s | 1 KBi |
#6 |
Incorrecto
|
0.079 s | 6 KBi |
#7 |
Incorrecto
|
0.078 s | 5 KBi |
#8 |
Incorrecto
|
0.093 s | 6 KBi |
#9 |
Incorrecto
|
0.068 s | 6 KBi |
#10 |
Incorrecto
|
0.092 s | 7 KBi |
#include <iostream> using namespace std; #define endl '\n' #define ll long long int a[500100]; int ans[500100]; int main(){ ios::sync_with_stdio(0); cin.tie(0); int t; cin>>t; while(t--){ int n; cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; } int aux=a[n]; ans[n] = -1; for(int i=n-1; i>0; i--){ if(aux<=a[i]){ ans[i]=-1; aux=a[i]; }else{ ans[i]=aux; } } for(int i=1; i<=n; i++){ cout<<ans[i]<<" "; } cout<<endl; } }