포럼
문제 ICPC00156 ⇄ 인터랙티브

D. Dragon Balls

설명

During the showdown with Frieza on Namek, Krillin died yet again and needs to be brought back to life using the Dragon Balls. As everybody else is still busy fighting Frieza, the task of retrieving all seven Dragon Balls has fallen to you.

The balls are hidden at unknown locations in a 2D plane and you have been handed a Dragon Radar, designed by Bulma, that you must use to locate them. You can repeatedly fly to arbitrary locations, and the radar will then inform you about the distance to the closest Dragon Ball. If this distance is \(0\) this means that you found one of the balls and you can then recalibrate the radar so that it ignores the ball you just found.

With the battle still going on, and the radar having limited energy, you are obviously in a great hurry. You need to make sure to collect all the balls by using the radar no more than \(1\,000\) times.

Interaction This is an interactive problem. Your submission will be run against an interactor, which reads the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

The interactor first sends an integer \(n\) (\(1 \le n \le 7\)), the number of Dragon Balls you still need to find. The \(n\) balls are hidden at integer locations \((x,y)\) with \(0 \le x,y \le 10^6\). Your submission may not guess outside this area.

Your submission then repeatedly sends such an integer location \((x,y)\) and the interactor replies with an integer \(d\) (\(0 \le d \le 2\cdot 10^{12}\)), the square of the distance from \((x,y)\) to the closest remaining ball.

If \(d = 0\), the ball at \((x,y)\) is considered found and ignored in further guesses. When all balls are found, your submission should exit. Each location holds at most one ball.

Make sure you flush the buffer after each write.

A testing tool is provided to help you develop your solution. Interaction

제약
입력 형식
출력 형식
인터랙티브 문제
프로그램이 고정된 입력을 읽는 대신 표준 입출력으로 채점기와 메시지를 주고받습니다. 한 줄을 출력할 때마다 표준 출력을 flush하고(예: cout에 endl / print(..., flush=True) / System.out.flush()), 채점기의 응답을 읽으세요. 파일을 읽거나 쓰면 안 됩니다.
예제 1
입력
1
4 3
출력
예제 2
입력
2
4 3
5 5
출력
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2020

평가 및 의견

D. Dragon Balls

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

D. Dragon Balls

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8