結果

問題 No.1429 Simple Dowsing
ユーザー ryo_nryo_n
提出日時 2021-03-14 14:50:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 24,096 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:05:17
合計ジャッジ時間 1,764 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
23,724 KB
testcase_01 AC 37 ms
23,760 KB
testcase_02 AC 37 ms
24,096 KB
testcase_03 AC 37 ms
23,536 KB
testcase_04 AC 38 ms
23,772 KB
testcase_05 AC 38 ms
23,644 KB
testcase_06 AC 38 ms
24,036 KB
testcase_07 AC 38 ms
23,420 KB
testcase_08 AC 41 ms
24,036 KB
testcase_09 AC 37 ms
23,784 KB
testcase_10 AC 35 ms
23,440 KB
testcase_11 AC 35 ms
23,592 KB
testcase_12 AC 37 ms
23,616 KB
testcase_13 AC 35 ms
24,036 KB
testcase_14 AC 36 ms
23,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    print("? 0 0")
    sys.stdout.flush()
    N = int(input())

    a = -1
    b = -1
    for i in range(101):
        for j in range(101):
            if i ** 2 + j ** 2 == N:
                a = i
                b = j
                break
        if a != -1:
            break

    print("?", a, b)
    sys.stdout.flush()
    NN = int(input())
    if NN == 0:
        print("!", a, b)
    else:
        c = -1
        d = -1
        for i in range(101):
            for j in range(101):
                if (i - a) ** 2 + (j - b) ** 2 == NN and i ** 2 + j ** 2 == N:
                    c = i
                    d = j
                    break
            if c != -1:
                break
        print("!", c, d)

    sys.stdout.flush()


if __name__ == '__main__':
    main()
0