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;
#define ll long long
typedef vector<int> vi;
typedef vector<vi> vvi;
map<int,int> M;
int main(){
int n; cin>>n;
vector<int> v(n+1);
for(int i=1;i<=n;++i){
cin>>v[i];
M[v[i]] = i;
}
int ptr = 1;
while(ptr<=n){
int last = M[v[ptr]];
for(int i = ptr;i<=last;++i){
v[i] = v[ptr];
}
ptr = last+1;
}
for(int i=1;i<=n;++i){
cout<<v[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... |