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
#define vl vector<ll>
#define sl set<ll>
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define pb push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define tests while(t--)
using namespace std;
int main()
{
ll n, i, j;
cin >> n;
vl v(n);
for(ll&h : v) cin >> h;
map<ll, ll>mp;
for(i = 0; i < n; i++) mp[v[i]] = i;
for(i = 0; i < n; i++)
{
//cout << "i: " << i << "\n";
for(j = i; j <= mp[v[i]]; j++)
cout << v[i] << "\n";
i = mp[v[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... |