This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma comment(linker, "/STACK:100000000")
#include <bits/stdc++.h>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#define pb push_back
#define in insert
#define pll pair<ll,ll>
#define vpl vector<pll>
#define vll vector <ll>
#define vl vector<ll>
#define sl set<ll>
#define msl multiset<ll>
#define mll map<ll,ll>
#define mmll multimap<ll,ll>
#define mcl map<char,ll>
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define endl "\n"
#define speed ios_base::sync_with_stdio(false);cin.tie();cout.tie()
#define ll long long
#define ull unsigned long long
#define LMX LLONG_MAX
using namespace std;
#define REP(i, n) for (ll i=0;i<(n);i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a)
#define rep(a) F0R(_, a)
#define each(a, x) for (auto &a : x)
/*
#pragma omp parallel for
#pragma GCC optimize("0fast")
#pragma GCC target ("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
*/
ll gcd(ll a,ll b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
return (a/gcd(a,b))*b;
}
bool comp(pair <ll,ll> p1,pair <ll,ll> p2)
{
if(p1.first==p2.first)
{
return p1.second>p2.second;
}
return p1.first<p2.first;
}
vll v1;
ll getans(ll mid,ll n)
{
if(mid==0)
{
return 2000000001;
}
ll ans=0;
for(ll i=0;i<n;i++)
{
ans+=v1[i]/mid;
}
return ans;
}
void solve()
{
ll n;
cin>>n;
vll v1(n);
for(ll i=0;i<n;i++)
{
cin>>v1[i];
}
map <ll,ll> m1;
for(ll i=0;i<n;i++)
{
m1[v1[i]]=i;
}
for(ll i=0;i<n;i++)
{
for(ll j=i;j<=m1[v1[i]];j++)
{
cout<<v1[i]<<"\n";
}
i=m1[v1[i]];
}
}
int main ()
{
ll t=1;
//cin>>t;
while(t--)
{
solve();
}
}
/*
string
length
*/
/*
auto locate = [&](int x) -> int {
for (int i = 0; i < N; i++)
if (P[i] == x)
return i;
return -1;
};
function in funcition
*/
Compilation message (stderr)
Main.cpp:1: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
1 | #pragma comment(linker, "/STACK:100000000")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |