Bài đăng

Đang hiển thị bài đăng từ Tháng 1, 2021

Lý thuyết trò chơi

  D. Even-Odd Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output During their New Year holidays, Alice and Bob play the following game using an array  a a  of  n n  integers: Players take turns, Alice moves first. Each turn a player chooses any element and removes it from the array. If Alice chooses  even value , then she adds it to her score. If the chosen value is odd, Alice's score does not change. Similarly, if Bob chooses  odd value , then he adds it to his score. If the chosen value is even, then Bob's score does not change. If there are no numbers left in the array, then the game ends. The player with the highest score wins. If the scores of the players are equal, then a draw is declared. For example, if  n = 4 n = 4  and  a = [ 5 , 2 , 7 , 3 ] a = [ 5 , 2 , 7 , 3 ] , then the game could go as follows (there are other options): On the first move, Alice chooses  2 2  and get two points. Her score is now  2 2