Contest Duration: ~ (local time) (120 minutes) Back to Home

Submission #7478109

Source Code Expand

Copy
```from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor

INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
ret = -INF
for i in range(2, n+1):
print("? {0} {1}".format(1, i))
sys.stdout.flush()
dist = I()
if dist > ret:
ret = dist
v = i

ret = -INF
for j in range(1, n+1):
if v != j:
print("? {0} {1}".format(v, j))
sys.stdout.flush()
dist = I()
if dist > ret:
ret = dist
w = j

print("! {0}".format(ret))```

#### Submission Info

Submission Time 2019-09-12 22:45:54+0900 D - 高橋くんと木の直径 ryuhei_py PyPy3 (2.4.0) 100 1408 Byte AC 212 ms 39616 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt
Case Name Status Exec Time Memory
subtask0_0.txt 206 ms 39616 KB
subtask1_0.txt 210 ms 39236 KB
subtask1_1.txt 207 ms 39232 KB
subtask1_10.txt 199 ms 39232 KB
subtask1_11.txt 194 ms 39232 KB
subtask1_12.txt 197 ms 39232 KB
subtask1_13.txt 190 ms 39236 KB
subtask1_14.txt 192 ms 39232 KB
subtask1_15.txt 190 ms 39232 KB
subtask1_16.txt 189 ms 39232 KB
subtask1_17.txt 189 ms 39232 KB
subtask1_18.txt 190 ms 39236 KB
subtask1_19.txt 190 ms 39232 KB
subtask1_2.txt 207 ms 39236 KB
subtask1_20.txt 192 ms 39232 KB
subtask1_3.txt 199 ms 39236 KB
subtask1_4.txt 199 ms 39232 KB
subtask1_5.txt 202 ms 39232 KB
subtask1_6.txt 196 ms 39108 KB
subtask1_7.txt 198 ms 39232 KB
subtask1_8.txt 202 ms 39228 KB
subtask1_9.txt 198 ms 39232 KB
subtask2_0.txt 195 ms 39232 KB
subtask2_1.txt 200 ms 39232 KB
subtask2_10.txt 190 ms 39232 KB
subtask2_11.txt 212 ms 39232 KB
subtask2_12.txt 197 ms 39232 KB
subtask2_13.txt 206 ms 39228 KB
subtask2_14.txt 196 ms 39232 KB
subtask2_15.txt 199 ms 39228 KB
subtask2_16.txt 197 ms 39228 KB
subtask2_17.txt 198 ms 39232 KB
subtask2_18.txt 195 ms 39232 KB
subtask2_19.txt 188 ms 39232 KB
subtask2_2.txt 196 ms 39232 KB
subtask2_3.txt 196 ms 39228 KB
subtask2_4.txt 195 ms 39232 KB
subtask2_5.txt 198 ms 39236 KB
subtask2_6.txt 201 ms 39100 KB
subtask2_7.txt 196 ms 39232 KB
subtask2_8.txt 194 ms 39228 KB
subtask2_9.txt 193 ms 39232 KB