結果

問題 No.850 企業コンテスト2位
ユーザー simamumusimamumu
提出日時 2019-07-05 22:32:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 957 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 26,268 KB
平均クエリ数 200.07
最終ジャッジ日時 2023-09-23 17:30:53
合計ジャッジ時間 4,251 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
25,776 KB
testcase_01 AC 56 ms
25,780 KB
testcase_02 AC 56 ms
25,692 KB
testcase_03 AC 56 ms
25,692 KB
testcase_04 AC 56 ms
26,064 KB
testcase_05 AC 56 ms
26,232 KB
testcase_06 AC 56 ms
25,612 KB
testcase_07 AC 62 ms
26,248 KB
testcase_08 AC 64 ms
25,608 KB
testcase_09 AC 64 ms
25,988 KB
testcase_10 AC 71 ms
25,964 KB
testcase_11 AC 69 ms
26,200 KB
testcase_12 AC 70 ms
25,740 KB
testcase_13 AC 69 ms
25,912 KB
testcase_14 AC 69 ms
25,968 KB
testcase_15 AC 68 ms
26,268 KB
testcase_16 AC 68 ms
25,764 KB
testcase_17 AC 69 ms
26,080 KB
testcase_18 AC 68 ms
25,896 KB
testcase_19 AC 69 ms
25,716 KB
testcase_20 AC 69 ms
26,076 KB
testcase_21 AC 70 ms
25,764 KB
testcase_22 AC 70 ms
25,568 KB
testcase_23 AC 70 ms
26,072 KB
testcase_24 AC 69 ms
25,580 KB
testcase_25 AC 70 ms
25,820 KB
testcase_26 AC 70 ms
25,600 KB
testcase_27 AC 57 ms
26,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N = inp()
lines = defaultdict(set)
tops = [i+1 for i in range(N)]
newtops = []
while len(tops) >= 2:
    for i in range(0,len(tops)//2*2,2):
        x, y = tops[i],tops[i+1]
        print('?',x,y)
        if inp() == x:
            lines[x].add(y)
            newtops.append(x)
        else:
            lines[y].add(x)
            newtops.append(y)

    if len(tops)%2 == 1:
        tops = [tops[-1]] + newtops[:]
    else:
        tops = newtops[:]        
    newtops = []

seconds = list(lines[tops[0]])
ans = seconds[0]
for i in range(1,len(seconds)):
    s = seconds[i]
    print('?',ans,s)
    if inp() != ans:
        ans = s

print('!',ans)
0