結果
問題 | No.513 宝探し2 |
ユーザー | c-yan |
提出日時 | 2020-11-25 07:30:19 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 10,784 KB |
実行使用メモリ | 24,508 KB |
平均クエリ数 | 49.00 |
最終ジャッジ日時 | 2023-09-24 02:48:58 |
合計ジャッジ時間 | 1,600 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
23,816 KB |
testcase_01 | AC | 42 ms
24,508 KB |
testcase_02 | AC | 41 ms
23,944 KB |
testcase_03 | AC | 41 ms
24,040 KB |
testcase_04 | AC | 41 ms
24,080 KB |
testcase_05 | AC | 40 ms
24,448 KB |
testcase_06 | AC | 41 ms
23,860 KB |
testcase_07 | AC | 40 ms
23,860 KB |
testcase_08 | AC | 41 ms
23,832 KB |
testcase_09 | AC | 41 ms
23,916 KB |
testcase_10 | AC | 42 ms
23,988 KB |
testcase_11 | AC | 42 ms
24,124 KB |
ソースコード
cache = {} def query(x, y): if (x, y) in cache: return cache[x, y] print(x, y) result = int(input()) cache[x, y] = result if result == 0: exit() return result l = 0 r = 100000 while r - l >= 3: c1 = (l * 2 + r) // 3 c2 = (l + r * 2) // 3 if query(c1, 0) > query(c2, 0): l = c1 else: r = c2 mv = query(l, 0) mi = l for j in range(l + 1, r + 1): if query(j, 0) >= mv: continue mv = query(j, 0) mi = j AX = mi AY = query(AX, 0) query(AX, AY)