結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-01-29 22:03:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,714 bytes |
| コンパイル時間 | 75 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 27,864 KB |
| 平均クエリ数 | 92.77 |
| 最終ジャッジ日時 | 2024-07-16 19:20:43 |
| 合計ジャッジ時間 | 2,327 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 RE * 2 |
ソースコード
import sys
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
pwd = ''.join(map(str, (random.randint(0,9) for _ in range(10))))
self.pwd = pwd
print('created:', pwd)
def resp_ques(self, *args):
guess = args[0]
if len(guess) != 10:
raise ValueError
x = sum(g == p for g,p in zip(guess, self.pwd))
if x == 10:
return '10 unlocked\n'
else:
return '{} locked\n'.format(x)
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()
def find_nth_value(n):
A = [0] * 10
best = -1
ret = 0
for i in range(10):
A[n] = i
word = ''.join(map(str,A))
correct, status = question(word).split()
if correct == 10:
exit()
correct = int(correct)
if best < correct:
best = correct
ret = i
return ret
A = [find_nth_value(n) for n in range(10)]
x = ''.join(map(str,A))
question(x)
exit()
maspy