| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 997899 | yanb | Stone Arranging 2 (JOI23_ho_t1) | C++14 | 109 ms | 18004 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 int long long
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
vector<int> nxt(n);
map<int, int> last;
for (int i = n - 1; i >= 0; i--) {
nxt[i] = (last[a[i]] ? last[a[i]] : -1);
last[a[i]] = i;
}
int i = 0;
while (i < n) {
int x = i;
for (; i < nxt[x]; i++) {
a[i] = a[x];
}
if (x == i) i++;
}
for (int i = 0; i < n; i++) cout << a[i] << "\n";
} | # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
