Submission #1129479

#TimeUsernameProblemLanguageResultExecution timeMemory
1129479KK_1729Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
141 ms13384 KiB
#include <bits/stdc++.h> using namespace std; // #define int long long #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define pb push_back #define all(a) a.begin(), a.end() #define endl "\n" void printVector(vector<int> a){ for (auto x: a) cout << x << " "; cout << endl; } void solve(){ int n; cin >> n; vector<int> a(n); FOR(i,0,n) cin >> a[i]; map<int, int> last; FOR(i,0,n){ last[a[i]] = i; } int o = 0; while (o < n){ int e = last[a[o]]; FOR(i,o,e){ a[i] = a[o]; } o = e+1; } printVector(a); } int32_t main(){ ios::sync_with_stdio(false);cin.tie(nullptr); 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...