Submission #1129872

#TimeUsernameProblemLanguageResultExecution timeMemory
1129872c0det1gerStone Arranging 2 (JOI23_ho_t1)C++20
100 / 100
194 ms16504 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define int long long #define double long double #define codetiger_orz cin.tie(0);cin.sync_with_stdio(0); signed main() { codetiger_orz int n; cin >> n; vector<int> v(n + 1); map<int, int> last; for (int i = 1; i <= n; i++){ cin >> v[i]; last[v[i]] = i; } int it = 1; while (it <= n){ int pre = it; while (it <= last[v[pre]]){ v[it] = v[pre]; it++; } } for (int i = 1; i <= n; i++){ cout << v[i] << "\n"; } } /* ____ ___ ___ ____ _____ ____ ____ ___ | | | | \ | | /| | | | \ | | | | | |____ | | | _ |____ |___/ | | | | | | | | | | | | \ |____ |___| |___/ |____ | __|__ |____| |____ | \ */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...