結果
| 問題 |
No.850 企業コンテスト2位
|
| コンテスト | |
| ユーザー |
simamumu
|
| 提出日時 | 2019-07-05 22:32:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 76 ms / 2,000 ms |
| コード長 | 957 bytes |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 28,496 KB |
| 平均クエリ数 | 200.07 |
| 最終ジャッジ日時 | 2024-07-16 17:23:55 |
| 合計ジャッジ時間 | 4,242 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
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)
simamumu