結果
問題 | No.2650 [Cherry 6th Tune *] セイジャク |
ユーザー |
![]() |
提出日時 | 2024-02-23 22:00:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 152 ms / 2,500 ms |
コード長 | 1,009 bytes |
コンパイル時間 | 3,529 ms |
コンパイル使用メモリ | 257,236 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 06:37:37 |
合計ジャッジ時間 | 8,612 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#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;}