結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2016-04-02 14:13:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 28,264 KB |
平均クエリ数 | 5.52 |
最終ジャッジ日時 | 2024-07-16 23:26:15 |
合計ジャッジ時間 | 6,705 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
import itertools as itr digits = list(range(10)) cands = [x for x in itr.permutations(digits, 4)] nxt_cands = [] while True: # 適当に先頭のクエリを投げる query = cands[0] print(*query) x, y = map(int, input().split()) if (x, y) == (4, 0): exit() # 返ってきた答えに合致する候補だけ残す for cand in cands[1:]: t_x, t_y = 0, 0 for (j, digit) in enumerate(query): if cand[j] == digit: t_x += 1 elif digit in cand: t_y += 1 if (t_x, t_y) == (x, y): nxt_cands.append(cand) cands = list(nxt_cands) nxt_cands = []