Submission #1130262

#TimeUsernameProblemLanguageResultExecution timeMemory
1130262AksLolCodingStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
168 ms13384 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> a(n); for (auto &i: a) cin >> i; // solve map<int, int> rightmost; for (int i = 0; i < n; i++) rightmost[a[i]] = i; vector<int> ans(n); int curpos = 0; while (curpos != n) { int color = a[curpos]; for (; curpos <= rightmost[color]; curpos++) ans[curpos] = color; } // ans for (int i: ans) cout << i << '\n'; } signed main() { cin.tie(0)->sync_with_stdio(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...