結果

問題 No.934 Explosive energy drink
ユーザー maspymaspy
提出日時 2020-02-02 21:31:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 699 ms / 2,000 ms
コード長 1,370 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 24,796 KB
平均クエリ数 709.58
最終ジャッジ日時 2023-09-23 19:34:48
合計ジャッジ時間 7,853 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
24,276 KB
testcase_01 AC 697 ms
24,224 KB
testcase_02 AC 41 ms
24,564 KB
testcase_03 AC 344 ms
24,008 KB
testcase_04 AC 699 ms
24,056 KB
testcase_05 AC 42 ms
24,356 KB
testcase_06 AC 41 ms
24,020 KB
testcase_07 AC 41 ms
24,052 KB
testcase_08 AC 41 ms
24,648 KB
testcase_09 AC 41 ms
24,292 KB
testcase_10 AC 42 ms
23,876 KB
testcase_11 AC 42 ms
24,664 KB
testcase_12 AC 46 ms
24,376 KB
testcase_13 AC 52 ms
24,528 KB
testcase_14 AC 54 ms
24,132 KB
testcase_15 AC 220 ms
24,172 KB
testcase_16 AC 78 ms
24,008 KB
testcase_17 AC 127 ms
24,064 KB
testcase_18 AC 128 ms
23,996 KB
testcase_19 AC 264 ms
24,340 KB
testcase_20 AC 451 ms
24,568 KB
testcase_21 AC 483 ms
24,124 KB
testcase_22 AC 682 ms
24,796 KB
testcase_23 AC 698 ms
24,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

import itertools

N = int(readline())

# DEBUG = True
DEBUG = False

class Interactive:
    def __init__(self):
        self.ques_cnt = 0
        self.create_data()
        
    def create_data(self):
        import random
        K = random.randint(1,N)
        A = list(range(1,N+1))
        random.shuffle(A)
        A = set(A[:K])
        self.K = K
        self.A = A
        print('created', K,A)
        
    def resp_ques(self, *args):
        if set(args) & self.A:
            return '1\n'
        else:
            return '0\n'
            
    def resp_ans(self, *args):
        if set(args) == self.A:
            print('AC')
        else:
            print('WA')
            
if DEBUG:
    interactive = Interactive()
    
def question(*args, offset='?'):
    print('? {}'.format(len(args)), flush=True)
    print(*args, flush=True)
    if DEBUG:
        resp = interactive.resp_ques(*args)
        print(resp, end='')
        return resp
    else:
        return readline()
    
def answer(*args, offset='!'):
    print('! {}'.format(len(args)), flush=True)
    print(*args, flush=True)
    if DEBUG:
        interactive.resp_ans(*args)
    else:
        exit()

A = []
for i in range(1,N+1):
    resp = int(question(*itertools.chain(range(1,i), range(i+1,N+1))))
    if resp == 0:
        A.append(i)

answer(*A)
0