#include /* S.size() s.substr(l,r=s.size()-l) -> l文字目からr文字分 __gcd() lower_bound(a+l,a+r,x)-a でindex // 配列 -> min/max({}) // vector-> *min_element(a+l,a+r) *忘れず lとrで[l,r) //reverse(a+l,a+r) 配列aの[l,r)を逆順に strはreverse(all(s)) //sort(a+l,a+r,greater ()) 配列aの[l,r)昇順sort,大きい順はgreater() //vectorならall(v) clock()/CLOCKS_PER_SEC で秒数 vector v.push_back(x),v.pop_back() q.push(x),front()で先頭を返す,pop()で削除, size(),empty() (push/pop)_(front/back)/fornt/back/insert/ priority_queue 宣言は priority_queue< Type, vector, greater> Q1; // pq.push(x),top()で参照 pop()で削除 greaterで最小 lessで最大がtopに*/ using namespace std; #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define repl(i, s, n) for (ll i = (s); i < (ll)(n); i++) #define rrep(i,n) for(int (i)=(n)-1;(i)!=-1;(i)--) #define vep(i,v) for(auto (i)=v.begin();(i)<(v.end());(i)++) template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } inline long long ceildiv(long long a, long long b) { return (a+b-1)/b; } typedef pair P; typedef pair PI; typedef std::vector vi; typedef std::vector> vvi; typedef std::vector> vvl; typedef std::vector vc; typedef std::vector> vvc; typedef std::vector vl; typedef std::vector vb; typedef std::vector> vvb; using Graph = std::vector >; const long long inf = 10e17; const long long mod = 1000000007; //int |x|<=2*10**9 long |x|<= 9*10**18 //printf(".(小数点以下の桁数)lf(double時、float ならf)") #define ll long long #define print(i) std::cout << (i) << '\n' struct union_find{ std::vector table; int Size; union_find(int si):table(si,-1){Size=si;} int find(int x){return table.at(x)<0? x:table.at(x)=find(table.at(x));} int size(int x){return -table.at(find(x));} bool unite(int x,int y){ x=find(x);y=find(y); if (x==y)return false; if (table.at(x)>table.at(y))std::swap(x,y); table.at(x)+=table.at(y); table.at(y)=x;return true;} bool same(int x,int y){return find(x)==find(y);} }; int main(){ int n,a,b;cin>>n>>a>>b; union_find uf(n); vi l(n);rep(i,n)cin>>l[i]; int left=0,right=0; rep(i,n){ int x=l[i]; while(left