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>
#define ll long long
using namespace std;
const ll maxn = 1e6 + 7;
map<ll,ll> m1;
map<ll,ll> m2;
ll n, a[maxn];
int main()
{
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
if(m1[a[i]] == 0)
m1[a[i]] = i;
else
m2[a[i]] = i;
}
for(int i = 1; i <= n; i++)
{
if(m2[a[i]] != 0)
{
for(int j = i; j <= m2[a[i]]; j++)
cout << a[i] << '\n';
i = m2[a[i]] ;
}
else
cout << a[i] << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |