제출 #775078

#제출 시각아이디문제언어결과실행 시간메모리
775078vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
179 ms23716 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; map < int, int > p; map < int, int > d; int i,n,a[N],j; int main() { ios_base::sync_with_stdio(0); cin.tie(); cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) if(p[a[i]]==0) { p[a[i]]=i; } else d[a[i]]=i; /*for(i=1;i<=n;i++) cout<<d[a[i]]<<" "<<p[a[i]]<<'\n'; */ for(i=1;i<=n;i++) if(d[a[i]]!=0) { for(j=i;j<=d[a[i]];j++) a[j]=a[i]; i=d[a[i]]; } for(i=1;i<=n;i++) cout<<a[i]<<" "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...