結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー maspymaspy
提出日時 2020-02-02 12:09:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 1,280 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 11,056 KB
実行使用メモリ 24,568 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-24 02:25:43
合計ジャッジ時間 3,979 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
24,152 KB
testcase_01 AC 57 ms
24,540 KB
testcase_02 AC 58 ms
24,224 KB
testcase_03 AC 58 ms
23,852 KB
testcase_04 AC 58 ms
24,256 KB
testcase_05 AC 58 ms
24,076 KB
testcase_06 AC 62 ms
24,264 KB
testcase_07 AC 59 ms
24,456 KB
testcase_08 AC 58 ms
24,220 KB
testcase_09 AC 61 ms
24,052 KB
testcase_10 AC 59 ms
24,132 KB
testcase_11 AC 61 ms
24,568 KB
testcase_12 AC 59 ms
24,044 KB
testcase_13 AC 59 ms
23,956 KB
testcase_14 AC 59 ms
24,416 KB
testcase_15 AC 59 ms
24,216 KB
testcase_16 AC 59 ms
24,252 KB
testcase_17 AC 60 ms
24,360 KB
testcase_18 AC 59 ms
24,468 KB
testcase_19 AC 58 ms
24,256 KB
testcase_20 AC 58 ms
23,844 KB
testcase_21 AC 59 ms
23,852 KB
testcase_22 AC 58 ms
24,120 KB
testcase_23 AC 60 ms
24,536 KB
testcase_24 AC 58 ms
23,884 KB
testcase_25 AC 59 ms
24,304 KB
testcase_26 AC 58 ms
24,168 KB
testcase_27 AC 58 ms
24,100 KB
testcase_28 AC 58 ms
24,136 KB
testcase_29 AC 59 ms
24,252 KB
権限があれば一括ダウンロードができます

ソースコード

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 = x + K + 1
0