結果

問題 No.3496 協力カード当て
コンテスト
ユーザー 👑 loop0919
提出日時 2026-04-14 23:10:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 1,822 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 184 ms
コンパイル使用メモリ 85,168 KB
実行使用メモリ 88,664 KB
スコア 0
平均クエリ数 53.50
最終ジャッジ日時 2026-04-14 23:54:27
合計ジャッジ時間 6,800 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import Counter

id, N, M = [int(s) for s in input().split()]
C = [int(s) - 1 for s in input().split()]

count = Counter(C)
all_cnt = [0] * M
ans = [0] * M


def log(n, base):
    ans = 0
    while n > 0:
        ans += 1
        n //= base
    return ans


def query(X):
    print("ASK", X)
    return get()


def get():
    _, X, K = input().split()
    return int(X), int(K)


def answer():
    result = []
    for i in range(M):
        for _ in range(ans[i]):
            result.append(i + 1)

    print("GUESS", *result)
    input()


def alice():
    for i in range(M):
        if input() == "TURN":
            X, K = query(i + 1)
        else:
            X, K = get()

        all_cnt[X - 1] = K

    if M % 2 == 1:
        input()
        get()

    for i in range(M):
        times = log(i + 1, M)

        op = 0

        for j in range(times):
            input()  # TURN
            query(((count[i] // M**j) % M) + 1)
            input()  # WAIT
            X, _ = get()
            op += (X - 1) * M**j

        ans[i] = all_cnt[i] - count[i] - op

    input()  # TURN
    answer()
    input()  # WAIT
    input()

    input()  # END


def bob():
    for i in range(M):
        if input() == "TURN":
            X, K = query(i + 1)
        else:
            X, K = get()

        all_cnt[X - 1] = K

    if M % 2 == 1:
        input()
        query(1)

    for i in range(M):
        times = log(i + 1, M)

        op = 0

        for j in range(times):
            input()  # WAIT
            X, _ = get()
            input()  # TURN
            query(((count[i] // M**j) % M) + 1)
            op += (X - 1) * M**j

        ans[i] = all_cnt[i] - count[i] - op

    input()  # WAIT
    input()
    input()  # TURN
    answer()

    input()  # END


if id == 1:
    alice()
else:
    bob()
0