結果
問題 | No.355 数当てゲーム(2) |
ユーザー | maspy |
提出日時 | 2020-02-29 01:50:08 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 1,504 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 27,728 KB |
平均クエリ数 | 25.67 |
最終ジャッジ日時 | 2024-07-17 02:34:48 |
合計ジャッジ時間 | 5,709 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
27,480 KB |
testcase_01 | AC | 53 ms
27,224 KB |
testcase_02 | AC | 52 ms
26,968 KB |
testcase_03 | AC | 54 ms
27,480 KB |
testcase_04 | AC | 53 ms
27,488 KB |
testcase_05 | AC | 57 ms
27,352 KB |
testcase_06 | AC | 55 ms
27,224 KB |
testcase_07 | AC | 53 ms
27,096 KB |
testcase_08 | AC | 52 ms
27,096 KB |
testcase_09 | AC | 53 ms
27,480 KB |
testcase_10 | AC | 51 ms
27,352 KB |
testcase_11 | AC | 53 ms
27,480 KB |
testcase_12 | AC | 54 ms
27,608 KB |
testcase_13 | AC | 54 ms
27,608 KB |
testcase_14 | AC | 51 ms
27,480 KB |
testcase_15 | AC | 54 ms
27,352 KB |
testcase_16 | AC | 52 ms
26,968 KB |
testcase_17 | AC | 53 ms
27,224 KB |
testcase_18 | AC | 53 ms
27,224 KB |
testcase_19 | AC | 54 ms
27,352 KB |
testcase_20 | AC | 55 ms
27,472 KB |
testcase_21 | AC | 54 ms
27,376 KB |
testcase_22 | AC | 52 ms
27,472 KB |
testcase_23 | AC | 53 ms
27,728 KB |
testcase_24 | AC | 54 ms
27,472 KB |
testcase_25 | AC | 52 ms
27,600 KB |
testcase_26 | AC | 51 ms
27,216 KB |
testcase_27 | AC | 53 ms
27,472 KB |
testcase_28 | AC | 52 ms
27,096 KB |
testcase_29 | AC | 52 ms
27,728 KB |
testcase_30 | AC | 54 ms
27,728 KB |
testcase_31 | AC | 53 ms
27,216 KB |
testcase_32 | AC | 53 ms
27,344 KB |
testcase_33 | AC | 53 ms
27,088 KB |
testcase_34 | AC | 53 ms
27,600 KB |
testcase_35 | AC | 52 ms
27,584 KB |
testcase_36 | AC | 52 ms
27,720 KB |
testcase_37 | AC | 52 ms
27,592 KB |
testcase_38 | AC | 52 ms
27,336 KB |
testcase_39 | AC | 52 ms
27,240 KB |
testcase_40 | AC | 53 ms
27,464 KB |
testcase_41 | AC | 53 ms
26,952 KB |
testcase_42 | AC | 52 ms
26,952 KB |
testcase_43 | AC | 52 ms
27,208 KB |
testcase_44 | AC | 53 ms
27,464 KB |
testcase_45 | AC | 53 ms
27,216 KB |
testcase_46 | AC | 52 ms
27,088 KB |
testcase_47 | AC | 53 ms
27,088 KB |
testcase_48 | AC | 55 ms
27,600 KB |
testcase_49 | AC | 52 ms
27,600 KB |
testcase_50 | AC | 53 ms
27,472 KB |
testcase_51 | AC | 53 ms
26,960 KB |
ソースコード
#!/usr/bin/env python3 # %% import sys readline = sys.stdin.readline import itertools # %% # DEBUG = True DEBUG = False # %% class Interactive: def __init__(self): self.ques_cnt = 0 self.create_data() def create_data(self): import random while True: N = [random.randint(0, 9) for _ in range(4)] if len(set(N)) < 4: continue break self.N = N print('created', N) def resp_ques(self, *args): assert len(set(args)) == 4 x = sum(a == b for a, b in zip(self.N, args)) xy = len(set(self.N) & set(args)) return f'{x} {xy-x}\n' def resp_ans(self, *args): pass if DEBUG: interactive = Interactive() def question(*args, offset=None): if offset is None: print(*args, flush=True) else: print(offset, *args, flush=True) if DEBUG: resp = interactive.resp_ques(*args) print(resp, end='') else: resp = readline() x,y = map(int,resp.split()) if x == 4: exit() return x,y # %% exists = [0] * 10 ask_789 = [sum(question(x,7,8,9)) for x in range(7)] for i in range(7): if ask_789[i] == max(ask_789): exists[i] = 1 ask_012 = [sum(question(x+3,0,1,2)) for x in range(7)] for i in range(7): if ask_012[i] == max(ask_012): exists[i+3] = 1 # %% nums = [i for i,x in enumerate(exists) if x] for a,b,c,d in itertools.permutations(nums): question(a,b,c,d)