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>
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int n;
int a[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n;
map<int, int> lst;
for(int i = 0; i < n; i++) {
cin >> a[i];
lst[a[i]] = i;
}
int l = 0;
while(l < n) {
int x = a[l], en = lst[x];
while(l < en)
a[l++] = x;
l++;
}
for(int i = 0; i < n; i++)
cout << a[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... |