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
#define ar array
#define rep(i, n) for(int i = 0; i<(int)n; ++i)
const int mxN = 2e5+5, MOD = 998244353;
map<int, vector<int>> mp;
void solve(){
int n;
cin >> n;
vector<int> a(n),ans(n);
for(auto &inp : a) cin >> inp;
map < int , int > ind;
for(int i = 0;i<n;i++)ind[a[i]] = i;
for(int i = 0;i<n;i++){
for(int j = i;j<=ind[a[i]];j++){
ans[j] = a[i];
}
i = ind[a[i]];
}
for(auto itr : ans)cout << itr << '\n';
}
int main(){
#ifdef _DEBUG
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |