시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
40 초 (추가 시간 없음) | 1024 MB | 0 | 0 | 0 | 0.000% |
The Pottery Palace is going to run a lottery featuring some valuable vases by the artist Cody-Jamal. The lottery works as follows:
You have been hired to test the security of the lottery, and you will participate in some trial runs. The company will always assign you the number 100 — that is, you replace player 100.
You have found some ways to tamper with the lottery at night, but security is tight, so you can only do so much! Specifically, after each of the first 99 days of the lottery, you may do exactly one of the following:
You may perform different actions on different nights, and you may choose dynamically: you do not need to decide on all of your actions in advance.
On the 100th day, it is your turn to insert your token into a vase of your choice (you do not need to choose uniformly at random). You cannot perform any other actions on that day.
You know that if there is a winning vase with more than one token for the same player, it will be obvious that cheating has occurred and nobody will win. However, it does not matter if other vases contain more than one token for the same player because the organizers never see those tokens.
Your goal is to be a winner in at least 90% of the test cases.
This is an interactive problem.
Initially, your program should read a single line containing a single integer T indicating the number of test cases. Then, you need to process T test cases.
At the start of a test case, the judge outputs one line with one integer: the number of the current day. (The judge starts on day 1, and on the i-th day, it prints i.) After your program reads the integer, it should write a line containing two integers V and P, with 1 ≤ V ≤ 20, and 0 ≤ P ≤ 100. The judge will interpret these as follows:
Notice that on turn 100, you must put your own token in, so P must be 100.
Remember that on the i-th day, for 1 ≤ i ≤ 99, the judge simulates the action of the i-th player, as described in the statement. This happens before your own action on that day.
After you send your move for turn 100, your program should terminate if it was the last test case; otherwise, it should start reading data for the next test case. (Notice that the judge does not tell you whether you got each case correct or incorrect.) The judge will only check whether you have enough correct answers after you have attempted all T test cases, so you should not stop early! For example, if you answer the first 225 out of 250 cases correctly and then exit, or provide malformed input, your solution will not be considered correct.
If your program outputs something illegal (e.g., gives an invalid value for P or V, or tries to inspect a vase on turn 100), the judge will send one line containing -1
to your input stream, and it will not send any other output after that. If your program continues to wait for the judge after receiving -1
, your program will time out, resulting in a Time Limit Exceeded error. Notice that it is your responsibility to have your program exit in time to receive a Wrong Answer judgment instead of a Time Limit Exceeded error. As usual, if the total memory is exceeded, or your program gets a runtime error, you will receive the appropriate judgment.
t = readline_int() // reads 250 into t curr_day = readline_int() // reads 1 (day 1) printline 8 100 to stdout // puts a token for player 100 into vase 8 flush stdout curr_day = readline_int() // reads 2 (day 2) printline 8 99 to stdout // puts a token for player 99 into vase 8 flush stdout curr_day = readline_int() // reads 3 (day 3) printline 8 100 to stdout // puts a token for player 100 into vase 8 flush stdout curr_day = readline_int() // reads 4 (day 4) printline 20 7 to stdout // puts a token for player 7 into vase 20 flush stdout curr_day = readline_int() // reads 5 (day 5) printline 8 0 to stdout // inspects vase 8 flush stdout tokens = readline_int_list() // reads 5 2 5 99 100 100 (players 2 and 5 // happen to have chosen vase 8) curr_day = readline_int() // reads 6 (day 6) printline 8 101 to stdout // tries to add a token with a bad player number flush stdout curr_day = readline_int() // reads -1 (judge has decided our solution is // incorrect) exit // exits to avoid an ambiguous TLE error
Contest > Google > Code Jam > Google Code Jam 2019 > Round 2 B번