제출 #1175310

#제출 시각아이디문제언어결과실행 시간메모리
1175310toplion7Stone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2094 ms3364 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...