제출 #1263417

#제출 시각아이디문제언어결과실행 시간메모리
1263417kustov_vadim_533Stone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2093 ms1608 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...