結果
| 問題 |
No.257 N言っちゃダメゲーム (3)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-02 12:09:56 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 1,280 bytes |
| コンパイル時間 | 95 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 27,736 KB |
| 平均クエリ数 | 3.70 |
| 最終ジャッジ日時 | 2024-07-17 02:28:00 |
| 合計ジャッジ時間 | 4,476 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
import sys
readline = sys.stdin.readline
# DEBUG = True
DEBUG = False
N,K = map(int,readline().split())
class Interactive:
def __init__(self):
self.ques_cnt = 0
self.create_data()
def create_data(self):
pass
def resp_ques(self, *args):
import random
self.ques_cnt += 1
if self.ques_cnt > 5:
return random.randint(N,N+K)
x = args[0]
if x >= N:
raise ValueError('You Lose')
return str(x + random.randint(1,K)) + '\n'
def resp_ans(self, *args):
pass
if DEBUG:
interactive = Interactive()
def question(*args, offset=None):
if offset is None:
print(*args, flush=True)
else:
print(offset, *args, flush=True)
if DEBUG:
resp = interactive.resp_ques(*args)
print(resp, end='')
return resp
else:
return readline()
def answer(*args, offset=None):
if offset is None:
print(*args, flush=True)
else:
print(offset, *args, flush=True)
if DEBUG:
interactive.resp_ans(*args)
else:
exit()
x = (N-1) % (K+1)
for _ in range(10):
resp = int(question(x))
if resp >= N:
exit()
x = x + K + 1
maspy