結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー kokoseikokosei
提出日時 2024-02-23 22:00:33
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 158 ms / 2,500 ms
コード長 1,009 bytes
コンパイル時間 3,239 ms
コンパイル使用メモリ 258,552 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-23 22:00:46
合計ジャッジ時間 8,899 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 39 ms
6,676 KB
testcase_03 AC 17 ms
6,676 KB
testcase_04 AC 100 ms
6,676 KB
testcase_05 AC 83 ms
6,676 KB
testcase_06 AC 37 ms
6,676 KB
testcase_07 AC 83 ms
6,676 KB
testcase_08 AC 29 ms
6,676 KB
testcase_09 AC 152 ms
6,676 KB
testcase_10 AC 154 ms
6,676 KB
testcase_11 AC 153 ms
6,676 KB
testcase_12 AC 152 ms
6,676 KB
testcase_13 AC 154 ms
6,676 KB
testcase_14 AC 158 ms
6,676 KB
testcase_15 AC 156 ms
6,676 KB
testcase_16 AC 112 ms
6,676 KB
testcase_17 AC 109 ms
6,676 KB
testcase_18 AC 111 ms
6,676 KB
testcase_19 AC 112 ms
6,676 KB
testcase_20 AC 112 ms
6,676 KB
testcase_21 AC 111 ms
6,676 KB
testcase_22 AC 113 ms
6,676 KB
testcase_23 AC 95 ms
6,676 KB
testcase_24 AC 95 ms
6,676 KB
testcase_25 AC 95 ms
6,676 KB
testcase_26 AC 96 ms
6,676 KB
testcase_27 AC 95 ms
6,676 KB
testcase_28 AC 95 ms
6,676 KB
testcase_29 AC 96 ms
6,676 KB
testcase_30 AC 118 ms
6,676 KB
testcase_31 AC 122 ms
6,676 KB
testcase_32 AC 69 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using ll = long long;

int op(int a, int b) { return max(a, b); }
int e() { return 0; }
using segtree = atcoder::lazy_segtree<int, op, e, int, op, op, e>;

int N, A;
int T;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> N >> A;
    vector<int> X(N), ord(N), ans(N);
    for(int i = 0;i < N;i++)cin >> X[i];
    for(int i = 0;i < N;i++)ord[i] = i;
    sort(ord.begin(), ord.end(), [&X](int a, int b){
        return X[a] < X[b];
    });
    sort(X.begin(), X.end());
    segtree seg(N);
    cin >> T;
    for(int i = 1;i <= T;i++){
        int l, r; cin >> l >> r;
        int il = lower_bound(X.begin(), X.end(), l) - X.begin();
        int ir = upper_bound(X.begin(), X.end(), r) - X.begin();
        seg.apply(il, ir, i);
    }
    for(int i = 0;i < N;i++){
        ans[ord[i]] = (seg.get(i) == 0 ? -1 : seg.get(i));
    }
    for(int i = 0;i < N;i++)cout << ans[i] << "\n";
    return 0;
}
0