# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774845 | vjudge1 | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 0 ms | 0 KiB |
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;
map<int,int>mp;
int dp[200001], cnt,n;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> dp[i];
mp[dp[i]] = i;
}
int sav;
for(int i = 1;i <= n;i++)
{
sav = map[dp[i]];
for(int j = 1;j <= sav - i + 1;j++)
{
cout << dp[i] << '\n';
}
i = sav;
}
}