#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
const int N = 300 + 10;
const int inf = 1e15;
const int mod = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int>a(n + 1);
map<int,int>lst;
for(int i = 1; i <= n; i++) {
cin >> a[i];
lst[a[i]] = i;
}
for(int i = 1; i <= n; i++) {
int j = lst[a[i]];
for(int k = i; k <= j; k++) a[k] = a[i];
i = j;
}
for(int i = 1; i <= n; i++) cout << a[i] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |