#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define int long long
#define double long double
#define codetiger_orz cin.tie(0);cin.sync_with_stdio(0);
signed main() {
codetiger_orz
int n;
cin >> n;
vector<int> v(n + 1);
map<int, int> last;
for (int i = 1; i <= n; i++){
cin >> v[i];
last[v[i]] = i;
}
int it = 1;
while (it <= n){
int pre = it;
while (it <= last[v[pre]]){
v[it] = v[pre];
it++;
}
}
for (int i = 1; i <= n; i++){
cout << v[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... |