結果

問題 No.1149 色塗りゲーム
ユーザー neterukunneterukun
提出日時 2020-07-05 12:57:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 87,868 KB
平均クエリ数 19.82
最終ジャッジ日時 2023-09-24 03:46:45
合計ジャッジ時間 9,077 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
87,356 KB
testcase_01 AC 97 ms
87,408 KB
testcase_02 AC 99 ms
87,252 KB
testcase_03 AC 100 ms
87,868 KB
testcase_04 AC 96 ms
87,528 KB
testcase_05 AC 99 ms
87,180 KB
testcase_06 AC 97 ms
87,468 KB
testcase_07 AC 95 ms
87,508 KB
testcase_08 AC 97 ms
87,440 KB
testcase_09 AC 102 ms
87,112 KB
testcase_10 AC 100 ms
86,820 KB
testcase_11 AC 99 ms
87,220 KB
testcase_12 AC 99 ms
87,232 KB
testcase_13 AC 99 ms
87,052 KB
testcase_14 AC 99 ms
87,384 KB
testcase_15 AC 98 ms
86,932 KB
testcase_16 AC 99 ms
86,712 KB
testcase_17 AC 102 ms
87,516 KB
testcase_18 AC 99 ms
86,904 KB
testcase_19 AC 99 ms
87,312 KB
testcase_20 AC 100 ms
87,232 KB
testcase_21 AC 101 ms
87,272 KB
testcase_22 AC 102 ms
86,984 KB
testcase_23 AC 103 ms
87,300 KB
testcase_24 AC 101 ms
86,904 KB
testcase_25 AC 103 ms
87,344 KB
testcase_26 AC 100 ms
86,772 KB
testcase_27 AC 102 ms
86,968 KB
testcase_28 AC 103 ms
86,776 KB
testcase_29 AC 103 ms
87,644 KB
testcase_30 AC 140 ms
87,856 KB
testcase_31 AC 139 ms
87,476 KB
testcase_32 AC 134 ms
87,284 KB
testcase_33 AC 138 ms
87,836 KB
testcase_34 AC 140 ms
87,236 KB
testcase_35 AC 134 ms
87,076 KB
testcase_36 AC 146 ms
87,492 KB
testcase_37 AC 147 ms
87,240 KB
testcase_38 AC 139 ms
87,844 KB
testcase_39 AC 146 ms
87,608 KB
testcase_40 AC 158 ms
87,168 KB
testcase_41 AC 146 ms
87,408 KB
testcase_42 AC 147 ms
87,732 KB
testcase_43 AC 143 ms
87,464 KB
testcase_44 AC 152 ms
86,924 KB
testcase_45 AC 164 ms
87,776 KB
testcase_46 AC 153 ms
87,444 KB
testcase_47 AC 168 ms
87,120 KB
testcase_48 AC 167 ms
87,468 KB
testcase_49 AC 170 ms
87,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def query(k, x):
    # output
    print(k, x)
    sys.stdout.flush()

    # input
    t = int(input())
    if t == 0:
        return True, -1, -1
    elif t == 1:
        return False, -1, -1
    elif t == 2:
        k, x = map(int, input().split())
        return False, -1, -1
    k, x = map(int, input().split())
    return False, k, x


n = int(input())

# 初手で半分に区切る
if n % 2 == 1:
    win, k, x = query(1, (n + 1) // 2)
else:
    win, k, x = query(2, n // 2)

# 相手の手を真似る
while not(win or k == -1):
    if k == 1:
        win, k, x = query(1, n + 1 - x)
    else:
        win, k, x = query(2, n - x)
exit()
0