結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-01-29 20:48:11 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 1,333 bytes |
| コンパイル時間 | 218 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 27,992 KB |
| 平均クエリ数 | 2.83 |
| 最終ジャッジ日時 | 2024-07-17 02:26:50 |
| 合計ジャッジ時間 | 1,690 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
import sys
readline = sys.stdin.readline
# DEBUG = True
DEBUG = False
class Interactive:
def __init__(self):
self.ques_cnt = 0
self.create_data()
def create_data(self):
import random
self.x = random.randint(0,10**5)
self.y = random.randint(0,10**5)
print('created:', self.x, self.y)
def resp_ques(self, *args):
x,y = map(int,args)
d = abs(x - self.x) + abs(y - self.y)
if d == 0:
print('AC')
exit()
return '{}\n'.format(d)
def resp_ans(self, *args):
pass
if DEBUG:
interactive = Interactive()
def question(*args, offset=None):
if offset is None:
print(*args, flush=True)
else:
print(offset, *args, flush=True)
if DEBUG:
resp = interactive.resp_ques(*args)
print(resp, end='')
return resp
else:
return readline()
def answer(*args, offset=None):
if offset is None:
print(*args, flush=True)
else:
print(offset, *args, flush=True)
if DEBUG:
interactive.resp_ans(*args)
else:
exit()
U = 10 ** 6
d1 = int(question(0,0))
if d1 == 0:
exit()
d2 = int(question(U,0))
if d2 == 0:
exit()
y = (d1 + d2 - U) // 2
x = d1 - y
question(x,y)
maspy