Submission #998662

#TimeUsernameProblemLanguageResultExecution timeMemory
9986620npataStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
139 ms18260 KiB
#include<bits/stdc++.h> using namespace std; #define vec vector #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vec<int> a(n); map<int, int> lst_ind; for(int i = 0; i<n; i++) { cin >> a[i]; lst_ind[a[i]] = i; } for(int i = 0; i<n-1; i++) { if(lst_ind[a[i]] > i) { a[i+1] = a[i]; } } for(int i = 0; i<n; i++) cout << a[i] << ' '; cout << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...