結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
|
提出日時 | 2016-10-29 12:40:01 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 948 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 32.69 |
最終ジャッジ日時 | 2024-07-17 00:35:02 |
合計ジャッジ時間 | 4,605 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
import sysdef communicate(S):print Ssys.stdout.flush()ans = map(int, raw_input().split())if ans == [4, 0]:exit()return ansans = [-1, -1, -1, -1]for keta in xrange(4):others = ['7','8','9']hits = []for i in xrange(7):hit, blow = communicate(' '.join(others[:keta]+[str(i)]+others[keta:]))hits.append(hit)for i in xrange(7):if hits[0] > hits[i]:ans[keta] = 0breakelif hits[0] < hits[i]:ans[keta] = iif ans[keta] != -1:continueothers = ['0','1','2']hits = []for i in xrange(7, 10):hit, blow = communicate(' '.join(others[:keta]+[str(i)]+others[keta:]))hits.append(hit)for i in xrange(3):if hits[0] > hits[i]:ans[keta] = 7breakelif hits[0] < hits[i]:ans[keta] = 7+icommunicate(' '.join(map(str, ans)))