제출 #1133631

#제출 시각아이디문제언어결과실행 시간메모리
1133631MunkhturErdenebatStone Arranging 2 (JOI23_ho_t1)C++20
35 / 100
141 ms2268 KiB
#include<bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include <stdlib.h>
 #define ll long long
using namespace std;
    ll a,b,c,d,e,f,m,i,j,n,h,g,l,r,ka,p,q,k[500005];
    map<ll,ll> maa,mii,mee;
    vector<ll> vis,vo,vi;
    pair<ll,ll> t[500005];
int main(){
    cin>>a;
    for(i=0 ; i<a ; i++){
        cin>>k[i];
        if(t[k[i]].first==0){
            t[k[i]].first=i+1;
        }
        else{
            t[k[i]].second=i+1;
        }
    }
    for(i=0 ; i<a ; i++){
        if(t[k[i]].second==0){
            t[k[i]].second=t[k[i]].first;
        }
    }
    g=1;
    while(g<=a){
        for(i=g ; i<=t[k[g-1]].second ; i++){
            cout<<k[g-1]<<endl;
        }
        g=t[k[g-1]].second+1;
    }
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...