|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||4||1||1||25.000%|
After a recent earthquake, a new island has emerged in the Adriatic sea! The island is mostly barren except for an unusual device that was discovered. The name “oracle” quickly caught on for the device. Although the oracle came with no instruction manual, a crack team of archaeologists and computer experts was able to understand its behavior.
The oracle provides information about the locations of treasure on the island. The island is divided into a grid of cells consisting of N rows and N columns, with both rows and columns numbered 1 through N. Some of the cells in the grid contain treasure. The oracle answers questions of the form “Given a rectangle in the grid, how many cells in the rectangle contain treasure?”
Although the oracle answers questions for rectangles of all sizes, it was found that the more specific the information requested (the smaller the rectangle), the more energy is used by the oracle when answering. More precisely, if a rectangle contains S cells, then the oracle uses exactly 1 + N×N - S units of energy to answer.
Write a program that will, given the ability to interact with the oracle, find the locations of all cells on the island that contain treasure. We do not want to use too much energy in the process – the less energy is used, the better. It is not required that the amount of energy used is the smallest possible – see the “Grading” section for details on how your solution will be scored.
This is an interactive task. Your program asks the oracle questions using the standard output, and receives answers by reading from the standard input.
You may assume that, in each test run, the oracle will correctly answer questions and the locations of treasure will be chosen prior to the interaction. In other words, the grader is not adaptive and the answers will not depend on previous questions asked by your program.
Each test case is worth 10 points. If the output of your program is incorrect, you get zero points for that test case. Otherwise, the number of points awarded to your program depends on the total number of energy units K used by the oracle. More precisely:
Additionally, in test data worth at least 40% of total points, N will be at most 20.
Your output will be considered correct even if your program guesses the correct solution, e.g. if it does not even ask a single question.
2 0 1 2
1 1 1 1 1 2 1 2 2 1 2 2 END 01 11