Submission #798788

#TimeUsernameProblemLanguageResultExecution timeMemory
798788vjudge1Stone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
290 ms26892 KiB
#include<bits/stdc++.h> using namespace std ; const int N = 2e5 ; int n, ind = 1, a[N + 1] ; signed main() { ios_base::sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ; cin >> n ; map<int, vector<int>> mp ; for(int i = 1 ; i <= n ; i++) { cin >> a[i] ; mp[a[i]].push_back(i) ; } while(ind <= n) { for(int i = ind ; i <= mp[a[ind]].back() ; i++) a[i] = a[ind] ; ind = mp[a[ind]].back() + 1 ; } for(int i = 1 ; i <= n ; i++) cout << a[i] << '\n' ; return 0 ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...