Submission #734586

#TimeUsernameProblemLanguageResultExecution timeMemory
734586rahidilbayramliStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
352 ms16360 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...