제출 #1329000

#제출 시각아이디문제언어결과실행 시간메모리
1329000lywoemStone Arranging 2 (JOI23_ho_t1)C++20
100 / 100
144 ms16516 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define l(a, b, i) for (ll i = a; i < b; i++)
#define rl(a, b, i) for (ll i = a; i >= b; i--)
#define vpair vector<pair<ll, ll>>
#define inf LLONG_MAX
#define ninf LLONG_MIN

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll N; cin >> N; vector<ll> vec(N + 1, 0);
    map<ll, ll> mp;
    l(1, N + 1, i) {
        cin >> vec[i];
        mp[vec[i]] = i;
    }

    ll start = 1;
    ll num = vec[start];
    ll lastidx = mp[num];
    
    while (lastidx <= N) {
        l(start, lastidx + 1, i) cout << num << "\n";
        start = lastidx + 1;
        if (start > N) break;
        num = vec[start];
        lastidx = mp[num];
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...