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;
const int MAXN = 2e5;
int a[MAXN];
map<int, int> lastPointer;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, i, color;
cin >> n;
for(i = 0; i < n; i++){
cin >> a[i];
lastPointer[ a[i] ] = i;
}
i = 0;
while(i < n){
color = a[i];
while(i <= lastPointer[color]){
a[i++] = color;
}
}
for(i = 0; 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... |