結果

問題 No.514 宝探し3
ユーザー maspymaspy
提出日時 2020-01-29 20:49:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 1,455 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 24,476 KB
平均クエリ数 2.83
最終ジャッジ日時 2023-09-23 19:31:12
合計ジャッジ時間 1,636 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
24,476 KB
testcase_01 AC 37 ms
23,716 KB
testcase_02 AC 37 ms
23,684 KB
testcase_03 AC 39 ms
24,288 KB
testcase_04 AC 37 ms
24,344 KB
testcase_05 AC 39 ms
24,416 KB
testcase_06 AC 39 ms
23,892 KB
testcase_07 AC 43 ms
24,180 KB
testcase_08 AC 37 ms
24,068 KB
testcase_09 AC 38 ms
23,964 KB
testcase_10 AC 37 ms
23,780 KB
testcase_11 AC 38 ms
23,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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 ** 9 + 10
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)
0