# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974803 | Isam | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 2029 ms | 15712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define eb emplace_back
constexpr int sz = 200005;
int n, a[sz], fa[sz];
unordered_map<int, int> mp;
int op[sz], co(1);
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
for(register int i = 1; i <= n; ++i){
cin >> a[i];
op[i] = a[i];
}
for(register int i = 1; i <= n; ++i){
if(op[mp[a[i]]] != a[i] || mp[a[i]] == 0){
mp[a[i]] = i;
continue;
}
int r = i;
while(r >= mp[a[i]]){
op[r--] = a[i];
}
mp[a[i]] = i;
}
for(register int i = 1; i <= n; ++i){
cout << op[i] << '\n';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |