結果
| 問題 | No.355 数当てゲーム(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-29 12:40:01 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 170 ms / 2,000 ms |
| + 1µs | |
| コード長 | 948 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 80,664 KB |
| 実行使用メモリ | 80,896 KB |
| 平均クエリ数 | 32.69 |
| 最終ジャッジ日時 | 2026-07-18 10:27:54 |
| 合計ジャッジ時間 | 5,290 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
ソースコード
import sys
def communicate(S):
print S
sys.stdout.flush()
ans = map(int, raw_input().split())
if ans == [4, 0]:
exit()
return ans
ans = [-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] = 0
break
elif hits[0] < hits[i]:
ans[keta] = i
if ans[keta] != -1:
continue
others = ['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] = 7
break
elif hits[0] < hits[i]:
ans[keta] = 7+i
communicate(' '.join(map(str, ans)))