結果
問題 |
No.2650 [Cherry 6th Tune *] セイジャク
|
ユーザー |
|
提出日時 | 2024-02-24 18:54:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 149 ms / 2,500 ms |
コード長 | 918 bytes |
コンパイル時間 | 2,333 ms |
コンパイル使用メモリ | 203,420 KB |
最終ジャッジ日時 | 2025-02-19 21:11:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/lazysegtree> using namespace std; using ll=long long; int seg_op(int a,int b){ return 0; } int seg_e(){ return -1; } int seg_comp(int f1,int f2){ return max(f1,f2); } int seg_id(){ return -1; } int seg_map(int f,int s){ return max(f,s); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,A; cin>>N>>A; vector X(N,0); for(int &i:X)cin>>i; auto X2=X; sort(X2.begin(),X2.end()); X2.erase(unique(X2.begin(),X2.end()),X2.end()); atcoder::lazy_segtree<int,seg_op,seg_e,int,seg_map,seg_comp,seg_id> seg(X2.size()); int Q; cin>>Q; for(int t=1;t<=Q;t++){ int L,R; cin>>L>>R; R+=1; L=lower_bound(X2.begin(),X2.end(),L)-X2.begin(); R=lower_bound(X2.begin(),X2.end(),R)-X2.begin(); seg.apply(L,R,t); } for(int i=0;i<N;i++){ cout<<seg.get(lower_bound(X2.begin(),X2.end(),X[i])-X2.begin())<<'\n'; } }