import sys import math import io import sys import random TARGET = 500000000000000000 random.seed(18) def cal_score(v1, v2, isDisplay = False): error1 = abs(v1-TARGET) error2 = abs(v2-TARGET) sa = max(error1,error2) #score = int(2 * 10**6 - 10**5 * math.log10(sa +1.0)) score = (int)(2000000.0 - 100000.0 * math.log10(1.0 * max(error1, error2) + 1.0)) if isDisplay: print(TARGET,v1,v2) print(error1,error2,score) return score def cal_temp_score(v1, v2, isDisplay = False): error1 = abs(v1-TARGET) error2 = abs(v2-TARGET) score = - error1 - error2 if isDisplay: print(error1,error2,score) return score def cal_ave(A,B, i,j): aveA,aveB = (A[i] + A[j])//2, (B[i] + B[j])//2 # print(i,j,A[i],A[j],aveA,B[i],B[j],aveB) A[i] = aveA A[j] = aveA B[i] = aveB B[j] = aveB # print("after", i,j,A[i],A[j],aveA,B[i],B[j],aveB) def save(A, B, i,j): return (i,j,A[i],B[i],A[j],B[j]) def restore(A, B, save): i,j = save[0], save[1] A[i],B[i],A[j],B[j] = save[2],save[3],save[4],save[5] def main(): args = sys.argv debug = False if len(args) >= 2: debug = True sys.setrecursionlimit(10000000) #H=int(input()) #A=list(map(int,input().split())) #A,B=map(int,input().split()) #A,B=input().split() #B = [list(map(int,input().split())) for _ in range(N)] # ε…₯εŠ› N = int(input()) A = [0] * (N +1) B = [0] * (N +1) for i in range(1,N+1): A[i], B[i] = map(int, input().split()) MAX_SOUSA = 50 TEMP_ITER = -1 # ε‡ΊεŠ› print(MAX_SOUSA) it = 0 for it in range(MAX_SOUSA): now_score = cal_score(A[1],B[1]) kouho = (1,1) for i in range(2, N + 1): save_info = save(A,B,1,i) cal_ave(A,B,1,i) score = cal_score(A[1],B[1]) restore(A,B,save_info) if now_score < score: kouho = (1,i) now_score = score if kouho[1] ==1: kouho_list = [] for k in range(2, N+1): for l in range(2, N+1): if l >= k: continue score = cal_score(A[k],B[l]) save_info = save(A,B,k,l) cal_ave(A,B,k,l) after_score = cal_score(A[k],B[l]) if after_score > score: kouho_list.append((after_score,(k,l))) restore(A,B,save_info) kouho_list.sort(reverse=True) kouho = kouho_list[0][1] cal_ave(A,B,kouho[0],kouho[1]) print(f"{kouho[0]} {kouho[1]}") if debug: print(it, "score") cal_score(A[1],B[1], True) if __name__ == "__main__": main()