제출 #1329720

#제출 시각아이디문제언어결과실행 시간메모리
1329720Valters07Stone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2094 ms800 KiB
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define en exit(0);
using namespace std;
const int N = 2e5 + 5;
const int INF = 1e9 + 5;
int a[N];
int main()
{
    fio
//    ifstream cin("in.in");
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        int lst = -1;
        for(int j = 1;j < i;j++)
            if(a[j] == a[i])
                lst = j;
        if(lst != -1)
            for(int j = lst;j <= i;j++)
                a[j] = a[i];
    }
    for(int i = 1;i <= n;i++)
        cout << a[i] << " ";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...