結果

問題 No.3238 Shadow
ユーザー t98slider
提出日時 2025-08-15 23:24:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 4,083 ms
コンパイル使用メモリ 255,680 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-15 23:24:34
合計ジャッジ時間 5,666 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;

int op(int lhs, int rhs){return max(lhs, rhs);}
constexpr int e(){return 0;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int,int>> b(n, make_pair(1 << 30, 1 << 30));
    atcoder::segtree<int, op, e> seg(n);
    for(int i = 0, v; i < n; i++){
        cin >> v, v--;
        int v2 = seg.prod(0, v);
        auto &&[x, y] = b[v2];
        x = min(x, i + 1);
        y = min(y, v + 1);
        seg.set(v, v2 + 1);
    }
    for(auto &&[x, y] : b){
        if(x >> 30) break;
        cout << x << ' ' << y << '\n';
    }
}
0