| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1218489 | agrim_09 | Stone Arranging 2 (JOI23_ho_t1) | C++20 | 98 ms | 16456 KiB | 
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl '\n';
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define py cout << "YES" << endl;
#define pn cout << "NO" << endl;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define int long long
typedef long long ll;
typedef unsigned long long ull;
const ll inf = 1e18;
const ll mod = 1e9+7;
// #ifndef ONLINE_JUDGE
// #include "algo/Standard_Stuff/debug.cpp"
// #else
// #define debug(...) 42
// #endif
void judge(){
    srand(time(NULL));
    #ifndef ONLINE_JUDGE
    freopen("1.txt","r",stdin);
    freopen("2.txt","w",stdout);
    #endif
}
// Look for edge cases!!!
signed main(){
    fastio; //judge();
    int n; cin >> n;
    vector<int>a(n);
    for(auto &x : a) cin >> x;
    map<int,int>mp;
    vector<pair<int,int>>ranges;
    for(int i = 0;i<n;i++){
        if(mp.find(a[i])!=mp.end()){
            ranges.pb({mp[a[i]],i});
        }
        mp[a[i]] = i;
    }
    sort(all(ranges));
    //debug(ranges);
    int l = -1, r = -1;
    for(auto [x,y]:ranges){
        if(l<x and x<r){
            continue;
        }
        for(int i = x;i<=y;i++){
            a[i] = a[x];
        }
        l = x;
        r = y;
    }
    for(auto x : a){
        cout << x << endl;
    }
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
