package main import . "fmt" import . "slices" func main() { var n int Scan(&n) a:=make([]int,n) for i:=range a { Scan(&a[i]) } b:=make([]int,101) for _,x:=range a { var z int Scan(&z) b[z]+=x } if b[0]==Max(b) { Println("YES") } else { Println("NO") } }