美国计算机奥赛USACO白金代考
Farmer John has fallen behind on organizing his inbox. The way his screen is organized, there is a vertical list of folders on the
left side of the screen and a vertical list of emails on the right side of the screen. There are M total folders numbered 1 .. M
Copyright By PowCoder代写 加微信 powcoder
1 < M < 104). His inbox currentiy contains V emails numbered 1.. V (1 < N < 103): the ith email needs to be filed into folde FU's screen is rather small, so he can only view K (1 ≤ K< min(N. M)) folders and K emails at once. Initially, his screen star out displaying folders 1... K on the left and emails 1 .. - K on the right. To access other folders and emails. he needs to scroll through these respective lists. For example, if he scrolls down one position in the list of folders, his screen will displav folders - K + 1, and then scrolling down one position further it will display folders 3.. K+ 2. When FJ drags an email into a folder the email disappears from the email list, and the emails after the one that disappeared shift up by one position. For example, if emails 1,2, 3, 4, 5 are currently displayed and FJ drags email 3 into its appropriate folder, the email list will now show emails 1,2, 4,5,6. FJ can only drag an email into the folder to which it needs to be filed. Unfortunately. the scroll wheel on FJ's mouse is broken, and he can only scroll downwards, not upwards. The only way he can achieve some semblance of upward scrolling is if he is viewing the last set of K emails in his email list, and he files one of thes In this case, the email list will again show the last K emails that haven't yet been filed, effectively scrolling the top email up by one. If there are fewer than K emails remaining, then all of them will be displayed. Please help FJ determine if it is possible to file all of his emails. INPUT FORMAT (input arrives from the terminal / stdin): The first line of input contains T (1 < T < 10), the number of subcases in this input, all of which must be solved correctly to solv the input case. The T subcases then follow. For each subcase, the first line of input contains M. N, and K. The next line contains fi...fN It is guaranteed that the sum of M over all subcases does not exceed 104, and that the sum of N over all subcases does not exceed 105 OUTPUT FORMAT (print output to the terminal / stdouty: Output I lines, each one either containing either YES or NO, specifying whether FJ can successfully file all his emails in each oi the T subcases. To qualify for cow camp, Bessie needs to eam a good score on the last problem of the USACOW Open contest. This problem has I distinct test cases (2 < 7 ≤ 10%) weighted equally. with the first test case being the sample case. Her final score will equal the number of test cases that her last submission passes Unfortunately. Bessie is way too tired to think about the problem, but since the answer to each test case is either yes" or "no, she has a plant Precisely, she decides to repeatedly submit the following nondeterministic solution if input == sample input: print sample output print "yes" each with probability 1/2, independently for each test case Note that for all test cases besides the sample this program may produce a different output when resubmitted, so the number of test cases that it passes will vary. Bessie kndys that she cannot submit more than K (1 ≤ K < 10P) times in total because then she will certainly be disqualtied. What is the maximum possible expected value of Bessie's final score assuming that she follows the optimal strategy? INPUT FORMAT (input arrives from the terminal / stdin): The only line of input contains two space-separated integers 7 and K OUTPUT FORMAT (print output to the terminal / stdout): The answer as a decimal that differs by at most 10-© absolute or relative error from the actual answer. SAMPLE INPUT SAMPLE OUTPUT. In this example, Bessie should keep resubmitting until she has reached 3 submissions or she receives full credit Bessie will receive full credit with probability & and half credit with probability ;, so the expected value of Bessie's final score under this strategy is 7 -2+ 1-1 1.875. As we see from this formula, the expected value of Bessie's score can be calculated by taking the sum over z of p(a) - I, where p(z) is the probability of recelving a score of r 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com