제출 #774697

#제출 시각아이디문제언어결과실행 시간메모리
774697vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
166 ms16388 KiB
#pragma GCC optimize("Ofast,unroll-loops") #include<bits/stdc++.h> #define pii pair<int,int> #define fi first #define se second #define int long long #define ld long double #define pb push_back using namespace std; using ll=long long; const int MN = 2e5+5; const int mod = 1e9+7; const int inf = 1e18; int n,a[MN]; map<int,int> cnt; inline void solve() { cin>>n; for (int i=1; i<=n; i++) { cin>>a[i]; cnt[a[i]]=i; } for (int i=1; i<=n; i++) { if(cnt[a[i]]>i) { for (int j=i; j<=cnt[a[i]]; j++) { a[j]=a[i]; } i=cnt[a[i]]; } } for (int i=1; i<=n; i++) { cout<<a[i]<<"\n"; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int t=1; // cin>>t; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...