#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define len(v) (int)((v).size())
template<typename T>
ostream& operator<<(ostream& out, const vector<T> &a){
for (auto& x : a){
out << x << ' ';
}
out << '\n';
return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &a){
for (size_t i = 0; i < a.size(); ++i){
in >> a[i];
}
return in;
}
mt19937 gen;
inline void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i){
cin >> a[i];
}
for (int i = 0; i < n; ++i){
for (int j = i - 1; j >= 0; --j){
if (a[j] == a[i]){
for (int f = j; f < i; ++f){
a[f] = a[i];
}
break;
}
}
}
for (int i = 0; i < n; ++i){
cout << a[i] << '\n';
}
cout << '\n';
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout.precision(60);
int t = 1;
// cin >> t;
while (t--) {
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... |