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;
#ifdef DEBUG
#include "/home/eagle/debug.h"
#else
#define debug(...) void(37)
#endif
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
int s = -1;
map<int, int> last;
for (int i = 0; i < N; ++i) {
last[A[i]] = i;
}
for (int i = 0; i < N; ++i) {
if (s < i) {
s = last[A[i]];
} else {
A[i] = A[i - 1];
}
}
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... |