Submission #774744

#TimeUsernameProblemLanguageResultExecution timeMemory
774744ngungunguStone Arranging 2 (JOI23_ho_t1)C++17
25 / 100
4 ms596 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e4 + 5;
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	ll n;
	cin >> n;
	ll a[maxn];
	map<ll, ll> d;
	for (ll i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (ll i = 1; i <= n; i++){
		d[a[i]] = i;
	}
	ll check;
	for (ll i = 1; i <= n; i++){
		check = d[a[i]];
		for (ll j = 1; j <= check - i + 1; j++){
			cout << a[i] << endl;
		}
		i = check;
	}
	
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...