제출 #792368

#제출 시각아이디문제언어결과실행 시간메모리
792368starchanStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
209 ms18332 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
signed main()
{
	fast();
	int n;
	cin >> n;
	vector<int> a(n+1);
	map<int, int> appear;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		appear[a[i]] = i;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = i+1; j < appear[a[i]]; j++)
			a[j] = a[i];
		i = appear[a[i]];
	}
	for(int i = 1; i <= n; i++)
		cout << a[i] << "\n";
	return 0;
}	
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...