結果

問題 No.1429 Simple Dowsing
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-03-14 14:15:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 24,380 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:02:45
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
24,380 KB
testcase_01 AC 38 ms
23,812 KB
testcase_02 AC 39 ms
24,232 KB
testcase_03 AC 43 ms
23,908 KB
testcase_04 AC 44 ms
24,268 KB
testcase_05 AC 38 ms
24,264 KB
testcase_06 AC 43 ms
23,832 KB
testcase_07 AC 41 ms
23,916 KB
testcase_08 AC 40 ms
24,116 KB
testcase_09 AC 39 ms
23,860 KB
testcase_10 AC 38 ms
23,840 KB
testcase_11 AC 42 ms
23,772 KB
testcase_12 AC 43 ms
24,168 KB
testcase_13 AC 40 ms
24,140 KB
testcase_14 AC 39 ms
24,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
write = sys.stdout.write
flush = sys.stdout.flush

# クエリ: "? x1 x2" を出力
def query(x1, x2):
    write("? %d %d\n" % (x1, x2))
    flush()
    # ジャッジから返される値を取得
    return readline().strip()

# 回答: "! x" を出力
def answer(x, y):
    write("! %d %d\n" % (x, y))
    flush()
    # 即時終了
    exit(0)
    
    
d0 = int(query(0,0))
d1 = int(query(0,1))

for i in range(101):
    for j in range(101):
        dis0 = i**2 + j**2
        dis1 = i**2 + (j-1)**2
        if dis0 == d0 and dis1 == d1:
            answer(i,j)
            exit()
0