翻译软件用了还是看不懂,循环(cycle)到底是什么意思,标签(label)又是怎么贴的?
附题目: Farmer John has N barns (3≤N≤5⋅105), of which K (3≤K≤N) distinct pairs of barns are connected.
First, Annabelle assigns each barn a distinct integer label in the range [1,N] , and observes that the barns with labels a1,…,aK are connected in a cycle, in that order. That is, barns ai and ai+1 are connected for all 1≤i<K , and barns aK and a1 are also connected. All ai are distinct.
Next, Bessie also assigns each barn a distinct integer label in the range [1,N] and observes that the barns with labels b1,…,bK are connected in a cycle, in that order. All b i are distinct.
Some (possibly none or all) barns are assigned the same label by Annabelle and Bessie. Compute the maximum possible number of barns that are assigned the same label by Annabelle and Bessie.