#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; typedef bitset<200000> BS; vector vc[100000]; BS ans,is,tmp; int main(){ int N; scanf("%d",&N); rep(i,N){ int x; scanf("%d",&x); vc[x-1].pb(i); } rep(i,N){ int x; scanf("%d",&x); is[i]=x; } rep(i,100000) if(vc[i].size()){ tmp.reset(); for(int x:vc[i]) tmp|=is<