제출 #933636

#제출 시각아이디문제언어결과실행 시간메모리
933636carriewangStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
128 ms15952 KiB
#include <bits/stdc++.h> #define ll long long #define vi vector<int> #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) x.size() #define all(x) x.begin(),x.end() #define F first #define S second using namespace std; const int maxn=1000005; int n,a[maxn]; map <int,int> r; int main(){ ios::sync_with_stdio(0),cin.tie(0); cin >> n; for(int i=0;i<n;i++){ cin >> a[i]; r[a[i]]=i; } for(int i=0;i<n;i++){ if(i==r[a[i]]) continue; for(int j=i+1;j<r[a[i]];j++) a[j]=a[i]; i=r[a[i]]; } for(int i=0;i<n;i++) cout << a[i] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...