This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
map<int,int> mp;
for(int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]] = i;
}
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < mp[a[i]]; j++) a[j] = a[i];
i = mp[a[i]];
}
for(auto i : a) cout << i << "\n";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |