#include <bits/stdc++.h>
#define int long long
using namespace std;
int dp[1005][1005];
const int MAXXX = 1e6 + 5;
const int inf = -1e9 - 5;
int a[2005];
int n;
void FUCK(int x)
{
if (x >= n) return;
int pos = inf;
for(int i = 0; i < x; i++)
{
if(a[i] == a[x])
{
pos = i;
break;
}
}
if (pos == inf) return;
for(int i = pos; i < x; i++)
{
a[i] = a[x];
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
vector<int> v(n);
stack<int> st;
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < n; i++)
{
FUCK(i);
}
for(int i = 0; i < n; i++) cout << a[i] << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |