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 Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 200'010;
int a[N];
map<int, int> last;
__attribute__((optimize("O3,unroll-loops"), target("avx2,prefer-vector-width=128")))
void myfill(int l, int r, int x)
{
Loop (i,l,r)
a[i] = x;
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int n;
cin >> n;
Loop (i,0,n) {
cin >> a[i];
if (auto it = last.find(a[i]); it == last.end() || a[it->second] != a[i])
last[a[i]] = i;
myfill(last[a[i]], i, a[i]);
}
Loop (i,0,n)
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... |