結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー maspymaspy
提出日時 2020-02-02 12:08:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,293 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 11,088 KB
実行使用メモリ 24,640 KB
平均クエリ数 5.00
最終ジャッジ日時 2023-09-23 19:32:53
合計ジャッジ時間 4,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
24,448 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 63 ms
23,996 KB
testcase_05 AC 59 ms
23,936 KB
testcase_06 AC 58 ms
24,084 KB
testcase_07 AC 59 ms
24,144 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 58 ms
24,576 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 60 ms
24,308 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 = resp + (-resp) % (K+1)
0