# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937602 | tw20000807 | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 1 ms | 348 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>
#define int long long
using namespace std;
signed main(){
int n;
cin >> n;
map<int, int> mp;
vector< int > v(n), tag(n);
int last = 0;
for(int i = 0; i < n; ++i){
cin >> v[i];
if(mp.count(v[i])){
tag[i] = mp[v[i]];
}
else{
tag[i] = i;
}
mp[v[i]] = i;
}
for(int i = n - 1; i >= 0; --i){
for(int j = i; j >= tag[i]; --j){
v[j] = v[i];
}
i = tag[i];
}
for(auto &i : v) cout << 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... |