結果

問題 No.304 鍵(1)
ユーザー maspymaspy
提出日時 2020-01-21 13:37:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 1,334 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 11,044 KB
実行使用メモリ 24,816 KB
平均クエリ数 309.17
最終ジャッジ日時 2023-09-24 02:24:09
合計ジャッジ時間 1,219 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
24,816 KB
testcase_01 AC 47 ms
24,808 KB
testcase_02 AC 88 ms
24,576 KB
testcase_03 AC 45 ms
24,672 KB
testcase_04 AC 65 ms
24,688 KB
testcase_05 AC 46 ms
24,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import wraps
readline = sys.stdin.readline

# DEBUG = True
DEBUG = False

class Interactive:
    def __init__(self):
        self.ques_cnt = 0
        self.create_data()
    
    def create_data(self):
        import random
        x = random.randint(0,999)
        pwd = '{:03}'.format(x)
        print('created pwd:', pwd)
        self.pwd = pwd
        
    def resp_ques(self, *args):
        self.ques_cnt += 1
        if args == (self.pwd,):
            return 'unlocked\n'
        else:
            return 'locked\n'
            
    def resp_ans(self, *args):
        print('question cnt:', self.ques_cnt)
        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)
        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()

for x in range(1000):
    ques = '{:03}'.format(x)
    resp = question(ques).rstrip()
    if resp == 'unlocked':
        break
0