結果

問題 No.3496 協力カード当て
コンテスト
ユーザー titia
提出日時 2026-04-15 04:24:17
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 2,099 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 667 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 40,680 KB
スコア 52
平均クエリ数 49.00
最終ジャッジ日時 2026-04-15 04:24:27
合計ジャッジ時間 9,535 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
from collections import Counter

LIST=[]
C=Counter()


com,N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

if N<M:

    ind=0
    while True:
        if len(LIST)==N and ind==N:
            break
        S=input().strip()

        if S=="TURN":
            if ind<N:
                print("ASK",A[ind],flush=True)
                ind+=1
            else:
                break
        elif S=="WAIT":
            pass

        ret=input().split()
        if ret[0]=="COUNT":
            x,y=int(ret[1]),int(ret[2])
            C[x]=y

            if S=="WAIT":
                LIST.append(x)

else:
    CA=Counter(A)
    ind=1
    while True:
        if len(LIST)==N and ind==M:
            break
        S=input().strip()

        if S=="TURN":
            xx=CA[ind]
            if xx==0:
                xx=M

            print("ASK",xx,flush=True)
        elif S=="WAIT":
            pass

        ret=input().split()
        if ret[0]=="COUNT":
            x,y=int(ret[1]),int(ret[2])
            C[x]=y

            if S=="WAIT":
                if x!=M:
                    LIST+=[ind]*x
                else:
                    pass

        if S=="WAIT" and com==1:
            ind+=1
        if S=="TURN" and com==2:
            ind+=1

if len(LIST)<N:
    LIST+=[M]*(len(LIST)-N)
    

while True:
    S=input().strip()
    
    if S=="TURN":
        flag=0
        for i in range(1,M+1):
            if i in C:
                pass
            else:
                flag=1
                print("ASK",i,flush=True)
                break

        if flag==0:
            ANS=[]
            C1=Counter(A)
            C2=Counter(LIST)

            for i in range(1,M+1):
                x=C[i]-C1[i]-C2[i]

                ANS+=[i]*x

            print("GUESS",*ANS,flush=True)
                
                
    elif S=="WAIT":
        pass
    else:
        if S[0]=="E":
            break

    ret=input().split()

    if ret[0]=="COUNT":
        x,y=int(ret[1]),int(ret[2])
        C[x]=y

    
    
        
        
    
0