結果

問題 No.3496 協力カード当て
コンテスト
ユーザー K2
提出日時 2026-04-14 22:15:01
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 1,306 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,843 ms
コンパイル使用メモリ 85,036 KB
実行使用メモリ 87,380 KB
スコア 97
平均クエリ数 43.81
最終ジャッジ日時 2026-04-14 23:51:36
合計ジャッジ時間 5,407 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

I, N, M = map(int, input().split())
I -= 1
A = list(map(int, input().split()))

history = {}


def ask(n: int):
    print("ASK", n)


def get_res():
    s = input().split()
    a, b = map(int, s[1:])
    if s[0] == "COUNT":
        history[a] = b
    return s[0] == "COUNT", a, b


B = []
for i in range(N):
    if I == 0:
        assert input() == "TURN"
        ask(A[i])
        get_res()
        assert input() == "WAIT"
        B.append(get_res()[1])
    else:
        assert input() == "WAIT"
        B.append(get_res()[1])
        assert input() == "TURN"
        ask(A[i])
        get_res()


n = N
C = []
pend = list(range(1, M + 1))


def update(i):
    global n
    assert i in history
    if i in pend:
        pend.remove(i)
        k = history[i] - A.count(i) - B.count(i)
        n -= k
        C.extend([i] * k)


for i in range(1, M + 1):
    if i not in history:
        continue
    update(i)

t = 0
while True:
    if t ^ I == 0:
        assert input() == "TURN"
        if n == 0:
            C.sort()
            print("GUESS", *C)
            break
        x = pend[-1]
        ask(x)
        get_res()
        update(x)
    else:
        assert input() == "WAIT"
        s, a, b = get_res()
        if not s:
            assert n == 0
        else:
            update(a)
    t ^= 1
0