| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 837965 | gun_gan | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 2068 ms | 14416 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;
const int MX = 2e5 + 5;
int A[MX];
map<int,int> cnt;
int N;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> N;
for(int i = 1; i <= N; i++) cin >> A[i];
for(int i = 1; i <= N; i++) {
if(cnt[A[i]] > 0) {
int j = i - 1;
while(j > 0 && A[j] != A[i]) {
cnt[A[j]]--;
A[j] = A[i];
cnt[A[j]]++;
j--;
}
}
cnt[A[i]]++;
}
for(int i = 1; i <= N; i++) cout << A[i] << " ";
cout << '\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... | ||||
