Submission #935446

#TimeUsernameProblemLanguageResultExecution timeMemory
935446qwe1rt1yuiop1Stone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
170 ms15392 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> v(n); for (int &i : v) cin >> i; map<int, int> lst; for (int i = 0; i < n; ++i) lst[v[i]] = i; vector<int> ans(n); for (int i = 0; i < n; ++i) { for (int j = i; j <= lst[v[i]]; ++j) ans[j] = v[i]; i = lst[v[i]]; } for (int i : ans) cout << i << '\n'; } /* 6 1 2 1 2 3 2 10 1 1 2 2 1 2 2 1 1 2 */ signed main() { ios::sync_with_stdio(0); cin.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...