제출 #799879

#제출 시각아이디문제언어결과실행 시간메모리
799879phoenixStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
145 ms14388 KiB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;


const int N = 2e5 + 10;

int n;
int a[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n;
    map<int, int> lst;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        lst[a[i]] = i;
    }
    int l = 0;
    while(l < n) {
        int x = a[l], en = lst[x];
        while(l < en) 
            a[l++] = x; 
        l++; 
    }
    for(int i = 0; i < n; i++) 
        cout << a[i] << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...