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