#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+1;
int n,a[N],ans[N],pre[N];
unordered_map<int,int>mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= n; i++) mp[a[i]] = i;
int x = 1;
while(x <= n){
int cc = mp[a[x]];
for(int i = x; i <= cc; i++) ans[i] = a[x];
x = cc+1;
}
for(int i = 1; i <= n; i++) cout << ans[i] << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |