#include "bits/stdc++.h" /* #include "boost/multiprecision/cpp_int.hpp" namespace mp = boost::multiprecision; using i128=mp::cpp_int; */ using namespace std; typedef long long ll; typedef int64_t i64; typedef vector vi; typedef vector vvi; typedef vector vvvi; typedef vector vll; typedef vector vvll; typedef vector vvvll; typedef vector vs; typedef vector vc; typedef vector vvc; typedef vector vd; typedef vector vvd; #define rep(i,a,n) for(int i=a;in;i--) #define yes(ans) if(ans)cout<<"yes"< struct lazysegment{ vector tree; vector func; int x=2; lazysegment(vector &data){ //nは数列の数 dataは数列の値(n個) int n=data.size(); while(x<2*n) x*=2; tree.assign(x-1,e()); //(0~x-2) func.assign(x-1,id()); int y=x/2; rep(i,y-1,x-1){ if(i-y+1>=n) continue; tree[i]=data[i-y+1]; } drep(i,y-2,-1){ tree[i]=op(tree[2*i+1],tree[2*i+2]); } } lazysegment(int n){ while(x<2*n) x*=2; tree.assign(x-1,e()); //(0~x-2) func.assign(x-1,id()); } void update(int a,int b,int k,int l,int r,F f,F g){ //最初の入力はquery(a,b,0,0,x/2,やりたい処理,id()) //[a,b)の取り出したい値を返す [l,r)は探索しているところ kはtreeのindex if(r<=a||b<=l){ func[k]=composition(g,func[k]); tree[k]=mapping(func[k],tree[k]); if(k>n; lazysegment seg=lazysegment(n); vi a(n); map mp; rep(i,0,n){ cin>>a[i]; mp[a[i]].push_back(i); } for(auto &[key,value]:mp){ seg.update(value[0],value[value.size()-1]+1,0,0,seg.x/2,F{key},id()); } rep(i,0,n){ cout<