제출 #1151883

#제출 시각아이디문제언어결과실행 시간메모리
1151883tsengangStone Arranging 2 (JOI23_ho_t1)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    ll n;
    cin >> n;
    ll a[n+4];
    map <ll,ll>m;
    for(ll i = 1; i <= n; i++){
        cin >> a[i];
        m[a[i]] = i;
    }
    ll cur = 1;
    for(ll i = 1; i <= n; i++){
        cout << a[cur] << ' ';
        if(i == cur){
            if(m[a[cur]] == i){
                cur++;
            }
        }
        else{
            if(a[i] == a[cur]){
                if(m[a[cur]] == i){
                    cur++;
                }
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...