ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Problem C. Spring Outing ### Source - [hihoCoder](http://hihocoder.com/contest/mstest2015april2/problem/3) ### Problem 鏃堕棿闄愬埗:20000ms 鍗曠偣鏃堕檺:1000ms 鍐呭瓨闄愬埗:256MB ### 鎻忚堪 You class are planning for a spring outing. N people are voting for adestination out of K candidate places. The voting progress is below: First the class vote for the first candidate place. If more than half of theclass agreed on the place, the place is selected. The voting ends. Otherwise they vote for the second candidate place. If more than half of theclass agreed on the place, the place is selected. The voting ends. Otherwise they vote for the third candidate place in the same way and go on. If no place is selected at last there will be no spring outing and everybodystays at home. Before the voting, the Chief Entertainment Officer did a survey, found outevery one's preference which can be represented as a permutation of 0, 1, ...K. (0 is for staying at home.) For example, when K=3, preference "1, 0, 2, 3"means that the first place is his first choice, staying at home is the secondchoice, the second place is the third choice and the third place is the lastchoice. The Chief Entertainment Officer sends the survey results to the class. Soeverybody knows the others' preferences. Everybody wants his more preferedplace to be selected. And they are very smart, they always choose the optimalstrategy in the voting progress to achieve his goal. Can you predict which place will be selected? ### 杈撳叆 The first line contains two integers, N and K, the number of people in yourclass and the number of candidate places. The next N lines each contain a permutation of 0~K, representing someone'spreference. For 40% of the data, 1 <= N, K <= 10 For 100% of the data, 1 <= N, K <= 1000 ### 杈撳嚭 Output the selected place. Or "otaku" without quotes if no place is selected. ### 鏍蜂緥鎻愮ず In the sample case, if the second peoson vote against the first place, noplace would be selected finally because the first person must vote against thesecond place for his own interest. Considering staying at home is a worsechoice than the first place, the second person's optimal strategy is votingfor the first place. So the first place will be selected. 鏍蜂緥杈撳叆 ~~~ 2 2 1 0 2 2 1 0 ~~~ 鏍蜂緥杈撳嚭 ~~~ 1 ~~~