結果

問題 No.355 数当てゲーム(2)
ユーザー nebukuro09nebukuro09
提出日時 2016-10-29 12:40:01
言語 Python2
(2.7.18)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 6,488 KB
実行使用メモリ 24,372 KB
平均クエリ数 32.69
最終ジャッジ日時 2023-09-24 00:40:30
合計ジャッジ時間 4,931 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
24,300 KB
testcase_01 AC 37 ms
23,988 KB
testcase_02 AC 35 ms
23,964 KB
testcase_03 AC 35 ms
24,324 KB
testcase_04 AC 35 ms
24,324 KB
testcase_05 AC 36 ms
24,372 KB
testcase_06 AC 35 ms
23,628 KB
testcase_07 AC 38 ms
23,400 KB
testcase_08 AC 35 ms
24,012 KB
testcase_09 AC 36 ms
23,532 KB
testcase_10 AC 35 ms
23,508 KB
testcase_11 AC 35 ms
23,580 KB
testcase_12 AC 36 ms
23,400 KB
testcase_13 AC 35 ms
24,288 KB
testcase_14 AC 36 ms
23,988 KB
testcase_15 AC 35 ms
24,228 KB
testcase_16 AC 35 ms
24,288 KB
testcase_17 AC 35 ms
23,616 KB
testcase_18 AC 35 ms
23,400 KB
testcase_19 AC 35 ms
23,808 KB
testcase_20 AC 36 ms
23,404 KB
testcase_21 AC 35 ms
23,800 KB
testcase_22 AC 35 ms
23,988 KB
testcase_23 AC 36 ms
23,364 KB
testcase_24 AC 35 ms
23,992 KB
testcase_25 AC 35 ms
23,364 KB
testcase_26 AC 35 ms
23,532 KB
testcase_27 AC 35 ms
23,652 KB
testcase_28 AC 36 ms
24,012 KB
testcase_29 AC 36 ms
23,628 KB
testcase_30 AC 37 ms
23,628 KB
testcase_31 AC 35 ms
23,532 KB
testcase_32 AC 35 ms
24,288 KB
testcase_33 AC 36 ms
24,232 KB
testcase_34 AC 36 ms
23,820 KB
testcase_35 AC 35 ms
24,036 KB
testcase_36 AC 35 ms
23,788 KB
testcase_37 AC 35 ms
23,616 KB
testcase_38 AC 35 ms
23,404 KB
testcase_39 AC 35 ms
23,800 KB
testcase_40 AC 35 ms
24,312 KB
testcase_41 AC 35 ms
23,628 KB
testcase_42 AC 35 ms
23,364 KB
testcase_43 AC 35 ms
23,964 KB
testcase_44 AC 35 ms
23,628 KB
testcase_45 AC 36 ms
24,016 KB
testcase_46 AC 36 ms
23,980 KB
testcase_47 AC 36 ms
24,040 KB
testcase_48 AC 36 ms
23,352 KB
testcase_49 AC 36 ms
23,784 KB
testcase_50 AC 35 ms
23,404 KB
testcase_51 AC 36 ms
23,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)))
0