Kotori and Umi are playing games of stones, which is hosted by Honoka. The rule is the same as the classic one: There are some piles of stones and the players take turns to remove any positive number of stones from one pile. The one who can't make a legal move loses the game. This time however, things will be a little different. As the host, Honoka will prepare the games from nnn candidate piles of stones, where the iii-th pile initially has aia_iai stones. Honoka will perform qqq operations of the following two types: Given three integers lll, rrr and xxx, for all l≤i≤rl le i le rl≤i≤r change the number of stones in the iii-th candidate pile to max(bi,x)max(b_i, x)max(bi,x), where bib_ibi is the current number of stones in the iii-th candidate pile. Given three integers lll, rrr and xxx, start a game of stones consisting of (r−l+2)(r-l+2)(r−l+2) piles where the iii-th pile contains bl−1+ib_{l-1+i}bl−1+i stones for all 1≤i<(r−l+2)1 le i < (r-l+2)1≤i<(r−l+2), and the (r−l+2)(r-l+2)(r−l+2)-th pile contains xxx stones. Note that this operation is only querying for answer and will not affect the state of the nnn candidate piles of stones. Kotori is always the first to move. As a big fan of Kotori, you would like to know, for each game of stones, the number of ways Kotori can play in the first step to ensure her victory if both players use the best strategy. We consider two ways different if Kotori is taking stones from different piles, or from the same pile but is taking different number of stones.
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。HBC216010裁缝大师,计算几何JustAnotherGameofStones题解
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。