結果
| 問題 | No.3418 【絶望】30個並列ごちゃ混ぜHit&Blowで遊ぼう! |
| コンテスト | |
| ユーザー |
Koi
|
| 提出日時 | 2025-12-25 00:28:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,217 ms / 5,000 ms |
| コード長 | 1,827 bytes |
| 記録 | |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 82,648 KB |
| 実行使用メモリ | 100,740 KB |
| スコア | 9,993,451 |
| 平均クエリ数 | 65.49 |
| 最終ジャッジ日時 | 2025-12-25 00:37:37 |
| 合計ジャッジ時間 | 75,516 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
ソースコード
# 順に全部聞く
# 答えにならないやつは聞かない
Subs = []
for i in range(100000):
is_ok = True
x = i
l = []
for j in range(5):
l.append(x % 10)
x //= 10
if(len(set(l)) == 5):
Subs.append(l)
# print(len(Subs))
# print(Subs)
Asks = []
Results = []
ac_cnt = 0
Hiddens = []
Used = []
def hit_and_blow(ql, al):
h = 0
b = 0
# TODO:高速化
for i in range(5):
for j in range(5):
if(ql[i] == al[j]):
if(i == j):
h += 1
else:
b += 1
return (h, b)
def is_possible(l):
# 今のResultsやHiddensと矛盾しないか
# 最悪30240^2かかるが大丈夫だろ 多分
for i in range(len(Results)):
is_found = False
for j in range(30):
if(not Used[i][j] and Results[i][j] == hit_and_blow(Asks[i], l)):
is_found = True
break
if(not is_found):
return False
return True
for l in Subs:
if(not is_possible(l)):
continue
print("".join([str(x) for x in l]))
Asks.append(l)
Result = [tuple(map(int, input().split())) for _ in range(30)]
now_ac_cnt = 0
Results.append(Result)
Used.append([False] * 30)
for i in range(30):
if(Result[i][0] == 5):
now_ac_cnt += 1
if(ac_cnt < now_ac_cnt):
Hiddens.append(l)
for i in range(len(Results)):
is_found = False
for j in range(30):
if(not Used[i][j] and Results[i][j] == hit_and_blow(Asks[i], l)):
Used[i][j] = True
is_found = True
break
assert(is_found)
ac_cnt = now_ac_cnt
if(now_ac_cnt == 30):
break
Koi