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 f first
#define s second
using namespace std;
long long n,i,j;
long long a[200005];
map<long long,long long> m;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n;
for (i=1;i<=n;i++){
cin>>a[i];
m[a[i]]=i;
}
for (i=1;i<=n;i++){
for (j=i;j<=m[a[i]];j++) a[j]=a[i];
i=m[a[i]];
}
for (i=1;i<=n;i++) cout<<a[i]<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |