結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー Nzt3
提出日時 2024-02-24 18:54:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 932 bytes
コンパイル時間 3,127 ms
コンパイル使用メモリ 256,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-29 10:12:49
合計ジャッジ時間 8,384 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
  }
  cout<<'\n';
}
0