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 N = 2e5 ;
int n, ind = 1, a[N + 1] ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
cin >> n ;
map<int, vector<int>> mp ;
for(int i = 1 ; i <= n ; i++)
{
cin >> a[i] ;
mp[a[i]].push_back(i) ;
}
while(ind <= n)
{
for(int i = ind ; i <= mp[a[ind]].back() ; i++)
a[i] = a[ind] ;
ind = mp[a[ind]].back() + 1 ;
}
for(int i = 1 ; 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... |