Submission #7058706


Source Code Expand

Copy
import sys

N = int(input())

def query(a, b):
    print("? {} {}".format(a, b))
    sys.stdout.flush()
    dist = int(input())
    return dist

md = 0
ev = -1

for v in range(2 ,N+1):
    dist = query(1, v)
    if dist > md:
        md = dist
        ev = v

for v in range(1, N+1):
    if v == ev:
        continue
    dist = query(ev, v)
    if dist > md:
        md = dist

print("! {}".format(md))

Submission Info

Submission Time
Task D - 高橋くんと木の直径
User pynomi
Language Python (3.4.3)
Score 100
Code Size 428 Byte
Status
Exec Time 26 ms
Memory 3660 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt
Subtask1 20 / 20 subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask0_0.txt
All 80 / 80 subtask0_0.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask2_0.txt, subtask2_1.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_2.txt, subtask2_3.txt, subtask2_4.txt, subtask2_5.txt, subtask2_6.txt, subtask2_7.txt, subtask2_8.txt, subtask2_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt 22 ms 3660 KB
subtask1_0.txt 26 ms 3528 KB
subtask1_1.txt 25 ms 3400 KB
subtask1_10.txt 26 ms 3524 KB
subtask1_11.txt 26 ms 3520 KB
subtask1_12.txt 26 ms 3524 KB
subtask1_13.txt 26 ms 3532 KB
subtask1_14.txt 26 ms 3528 KB
subtask1_15.txt 26 ms 3404 KB
subtask1_16.txt 25 ms 3524 KB
subtask1_17.txt 26 ms 3528 KB
subtask1_18.txt 26 ms 3400 KB
subtask1_19.txt 26 ms 3528 KB
subtask1_2.txt 26 ms 3524 KB
subtask1_20.txt 20 ms 3400 KB
subtask1_3.txt 26 ms 3524 KB
subtask1_4.txt 26 ms 3532 KB
subtask1_5.txt 26 ms 3528 KB
subtask1_6.txt 26 ms 3528 KB
subtask1_7.txt 25 ms 3524 KB
subtask1_8.txt 26 ms 3524 KB
subtask1_9.txt 26 ms 3400 KB
subtask2_0.txt 25 ms 3528 KB
subtask2_1.txt 26 ms 3528 KB
subtask2_10.txt 25 ms 3524 KB
subtask2_11.txt 25 ms 3524 KB
subtask2_12.txt 26 ms 3528 KB
subtask2_13.txt 25 ms 3404 KB
subtask2_14.txt 26 ms 3524 KB
subtask2_15.txt 26 ms 3520 KB
subtask2_16.txt 26 ms 3528 KB
subtask2_17.txt 26 ms 3528 KB
subtask2_18.txt 26 ms 3532 KB
subtask2_19.txt 25 ms 3528 KB
subtask2_2.txt 26 ms 3392 KB
subtask2_3.txt 26 ms 3528 KB
subtask2_4.txt 25 ms 3532 KB
subtask2_5.txt 25 ms 3524 KB
subtask2_6.txt 25 ms 3404 KB
subtask2_7.txt 25 ms 3528 KB
subtask2_8.txt 25 ms 3524 KB
subtask2_9.txt 26 ms 3524 KB