Submission #7477948


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()
    if I() > ret:
        v = i


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



print("! {0} {1}".format(v, w))

Submission Info

Submission Time
Task D - 高橋くんと木の直径
User ryuhei_py
Language PyPy3 (2.4.0)
Score 0
Code Size 1354 Byte
Status
Exec Time 2107 ms
Memory 42056 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt
Subtask1 0 / 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 0 / 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 2103 ms 39492 KB
subtask1_0.txt 2103 ms 39364 KB
subtask1_1.txt 2103 ms 39492 KB
subtask1_10.txt 2103 ms 39360 KB
subtask1_11.txt 2103 ms 39488 KB
subtask1_12.txt 2103 ms 39492 KB
subtask1_13.txt 2107 ms 39488 KB
subtask1_14.txt 2103 ms 42056 KB
subtask1_15.txt 2103 ms 39360 KB
subtask1_16.txt 2103 ms 39360 KB
subtask1_17.txt 2103 ms 39356 KB
subtask1_18.txt 2103 ms 39488 KB
subtask1_19.txt 2103 ms 39360 KB
subtask1_2.txt 2103 ms 39484 KB
subtask1_20.txt 2103 ms 39492 KB
subtask1_3.txt 2103 ms 39488 KB
subtask1_4.txt 2103 ms 41620 KB
subtask1_5.txt 2103 ms 39488 KB
subtask1_6.txt 2103 ms 39364 KB
subtask1_7.txt 2103 ms 39492 KB
subtask1_8.txt 2103 ms 41620 KB
subtask1_9.txt 2103 ms 39360 KB
subtask2_0.txt 2103 ms 39492 KB
subtask2_1.txt 2103 ms 39488 KB
subtask2_10.txt 2103 ms 39360 KB
subtask2_11.txt 2107 ms 39364 KB
subtask2_12.txt 2103 ms 39364 KB
subtask2_13.txt 2103 ms 39360 KB
subtask2_14.txt 2103 ms 39360 KB
subtask2_15.txt 2103 ms 41688 KB
subtask2_16.txt 2103 ms 39488 KB
subtask2_17.txt 2103 ms 39492 KB
subtask2_18.txt 2103 ms 39484 KB
subtask2_19.txt 2103 ms 41732 KB
subtask2_2.txt 2103 ms 39364 KB
subtask2_3.txt 2103 ms 39488 KB
subtask2_4.txt 2103 ms 39488 KB
subtask2_5.txt 2103 ms 39484 KB
subtask2_6.txt 2103 ms 39364 KB
subtask2_7.txt 2103 ms 39492 KB
subtask2_8.txt 2103 ms 39360 KB
subtask2_9.txt 2103 ms 39364 KB