HBC237297每日一报,排序Game题解

水水月牙 算法基础篇 48 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
Alice and Bob are playing a game. Initially, there arennn(1≤n≤1051le nle10^51≤n≤105) piles of stones, theiii-th of which hasaia_iai(1≤ai≤1051le a_i le10^51≤ai≤105) stones. We call a pile empty if

Alice and Bob are playing a game. Initially, there are nnn (1≤n≤1051le nle10^51≤n≤105) piles of stones, the iii-th of which has aia_iai​ (1≤ai≤1051le a_i le10^51≤ai​≤105) stones. We call a pile empty if there are no stones in it currently. Alice and Bob take turns to operate as follows (of course, Alice operates first): Arbitrarily pick one pile that is not empty. Remove some or all stones (at least one) of that pile. Rearrange the remained stones of that pile. That means, for each remaining stone of that pile, one can move it to another non-empty pile, or just do nothing(then it still remains in the same pile). The player who can't operate loses, or equally, the player who takes the last stone wins. It can be proved that Alice or Bob has a strategy to win the game. Alice and Bob are wondering who will win the game finally if they both play optimally. So, they give you the entire information about the piles of stones. Please determine who will win the game if they both play optimally. To make sure you handle their question seriously rather than just guess the right answer, they will ask QQQ questions, each of which contains l,rl,rl,r, which means that they will play a game on piles in [l,r][l,r][l,r]. You should answer all the questions correctly to convince them.

HBC237297每日一报,排序Game题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC237297每日一报 排序Game题解