結果
| 問題 |
No.253 ロウソクの長さ
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-01-12 01:49:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 71 ms / 2,000 ms |
| コード長 | 617 bytes |
| コンパイル時間 | 388 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 27,504 KB |
| 平均クエリ数 | 50.33 |
| 最終ジャッジ日時 | 2025-01-12 01:49:54 |
| 合計ジャッジ時間 | 5,080 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
OK=0
NG=10**9+1
c=0
while True:
if c%2==0:
print("?",1,flush=True)
x=int(input())
if x==-1:
print("!",c,flush=True)
break
elif x==0:
print("!",c+1,flush=True)
break
OK-=1
NG-=1
else:
mid=(OK+NG)//2
print("?",mid,flush=True)
x=int(input())
if x==-1:
NG=mid
OK-=1
elif x==1:
OK=mid-1
NG-=1
else:
print("!",max(0,mid+c),flush=True)
break
OK=max(0,OK)
NG=max(0,NG)
c+=1
titia