Submission #1136900

#TimeUsernameProblemLanguageResultExecution timeMemory
1136900domblyStone Arranging 2 (JOI23_ho_t1)C++20
100 / 100
139 ms16456 KiB
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
const int N = 300 + 10;
const int inf = 1e15;
const int mod = 1e9 + 7;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int>a(n + 1);
    map<int,int>lst;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        lst[a[i]] = i;
    }
    for(int i = 1; i <= n; i++) {
        int j = lst[a[i]];
        for(int k = i; k <= j; k++) a[k] = a[i];
        i = j;
    }
    for(int i = 1; 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...