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 = dp[dp[i]];
for(int j = 1;j <= sav - i + 1;j++)
{
cout << dp[i] << '\n';
}
i = sav;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |