Submission #1045197

#TimeUsernameProblemLanguageResultExecution timeMemory
1045197AlebnStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
134 ms18432 KiB
#include <bits/stdc++.h> #define int long long using namespace std; void solve() { int n; cin >> n; vector<int> a(n); map<int,int> mp; for(int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]] = i; } for(int i = 0; i < n; i++) { for(int j = i + 1; j < mp[a[i]]; j++) a[j] = a[i]; i = mp[a[i]]; } for(auto i : a) cout << i << "\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...