結果

問題 No.1149 色塗りゲーム
ユーザー もりをもりを
提出日時 2020-08-07 21:38:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 92,972 KB
平均クエリ数 5.30
最終ジャッジ日時 2023-09-24 04:10:54
合計ジャッジ時間 9,616 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
87,500 KB
testcase_01 AC 119 ms
87,120 KB
testcase_02 AC 116 ms
87,608 KB
testcase_03 AC 115 ms
87,596 KB
testcase_04 AC 115 ms
87,640 KB
testcase_05 AC 118 ms
87,576 KB
testcase_06 AC 116 ms
87,800 KB
testcase_07 AC 114 ms
87,520 KB
testcase_08 AC 115 ms
87,592 KB
testcase_09 AC 116 ms
87,252 KB
testcase_10 WA -
testcase_11 AC 121 ms
91,100 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 122 ms
91,540 KB
testcase_15 AC 122 ms
91,428 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby as gb

n = int(input())

a = [False for _ in range(n)]

def check(l):
    xr = 0
    for i in l:
        xr ^= i
    return xr == 0

def nim():
    l = []
    idx = 0
    for k, v in gb(a):
        sz = len(list(v))
        if k == False:
            l.append(sz)
        idx += sz
    return l

while True:
    nxt = [-1, -1]
    # 1個ぬり
    for i in range(n):
        if nxt[0] != -1:
            break
        if a[i] == False:
            a[i] = True
            if check(nim()):
                nxt = [1, i]
                break
            a[i] = False
    # 2個ぬり
    for i in range(n - 1):
        if nxt[0] != -1:
            break
        if a[i] == False and a[i + 1] == False:
            a[i], a[i + 1] = True, True
            if check(nim()):
                nxt = [2, i]
                break
            a[i], a[i + 1] = False, False
    print(nxt[0], nxt[1] + 1)
    t = int(input())
    if t in (0, 1):
        exit(0)
    k, x = map(int,input().split())
    if t == 2:
        exit(0)
    if k == 1:
        a[x - 1] = True
    else:
        a[x - 1], a[x] = True, True
0