Submission #924658

#TimeUsernameProblemLanguageResultExecution timeMemory
924658biankStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
178 ms14532 KiB
#include<bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<int(n);i++) #define forsn(i,s,n) for(int i=int(s);i<int(n);i++) int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> a(n); map<int,int> last; forn(i,n) { cin >> a[i]; last[a[i]] = i; } forn(i,n) { int j=last[a[i]]; forsn(k,i,j) a[k]=a[j]; i=j; } forn(i, n) cout << a[i] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...