Submission #906272

#TimeUsernameProblemLanguageResultExecution timeMemory
906272OAleksaStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
208 ms19432 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define f first #define s second signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt = 1; //cin >> tt; while (tt--) { int n; cin >> n; vector<int> a(n), ans(n); for (int i = 0;i < n;i++) cin >> a[i]; map<int, int> b; for (int i = 0;i < n;i++) b[a[i]] = i; int lst = -1; for (int i = 0;i < n;i++) { if (i == lst + 1) lst = b[a[i]]; ans[i] = a[lst]; } for (int i = 0;i < n;i++) cout << ans[i] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...