B - 採点/Grading Editorial by ngtkana


Boyer–Moore majority vote algorithm を使うと、\(O ( N )\) 時間で達成できます。(入力 \(M\) も受け取らなくて大丈夫です。)

posted:
last update: