結果
問題 |
No.2962 Sum Bomb Bomber
|
ユーザー |
![]() |
提出日時 | 2024-11-30 00:57:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 162 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 350 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 74,472 KB |
平均クエリ数 | 179.98 |
最終ジャッジ日時 | 2024-11-30 00:57:39 |
合計ジャッジ時間 | 13,745 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 64 |
ソースコード
from functools import lru_cache @lru_cache(maxsize=10000) def calc(X): x,y = X print(1,x,y) return int(input()) N = int(input()) lb = - 10 ** 8 ub = 10 ** 8 + 1 cnt = 0 while cnt < 50 and ub - lb > 3: mid1 = 2 * lb // 3 + ub // 3 mid2 = lb // 3 + 2 * ub // 3 if calc((mid1,0)) <= calc((mid2,0)): ub = mid2 else: lb = mid1 cnt += 1 xlb,xub = lb,ub lb = - 10 ** 8 ub = 10 ** 8 + 1 cnt = 0 while cnt < 50 and ub - lb > 3: mid1 = 2 * lb // 3 + ub // 3 mid2 = lb // 3 + 2 * ub // 3 if calc((0,mid1)) < calc((0,mid2)): ub = mid2 else: lb = mid1 cnt += 1 ylb,yub = lb,ub tmp = 10 ** 11 ans = [] for i in range(xlb,xub): for j in range(ylb,yub): t = calc((i,j)) if t < tmp: tmp = t ans = (i,j) print(2,*ans)