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 main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vector<int> a;
a.resize(n+2);
for(int i=1;i<=n;++i)
{
cin>>a[i];
mp[a[i]]=i;
}
for(int i=1;i<=n;++i)
{
if(mp[a[i]]==0)
{
cout<<a[i]<<"\n";
}
else
{
for(int j=i;j<=mp[a[i]];++j)
{
cout<<a[i]<<"\n";
}
i=mp[a[i]];
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |