結果
問題 | No.5020 Averaging |
ユーザー |
![]() |
提出日時 | 2024-02-25 13:55:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 61 ms / 1,000 ms |
コード長 | 2,664 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 64,052 KB |
スコア | 19,167,042 |
最終ジャッジ日時 | 2024-02-25 13:55:46 |
合計ジャッジ時間 | 4,967 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
import sysinput = lambda: sys.stdin.readline().rstrip()# sys.setrecursionlimit(10**7)# sys.set_int_max_str_digits(10**6)# import pypyjit# pypyjit.set_param('max_unroll_recursion=-1')def mp():return map(int,input().split())def lmp():return list(map(int,input().split()))def lm1(LIST): return list(map(lambda x:x-1, LIST))def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]def stoi(LIST):return list(map(int,LIST))def itos(LIST):return list(map(str,LIST))def atoi(LIST): return [ord(i)-ord("a") for i in LIST]def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]def LT(LIST,N): return LIST[bisect.bisect_left(LIST,N)-1]def LE(LIST,N): return LIST[bisect.bisect_right(LIST,N)-1]def GT(LIST,N): return LIST[bisect.bisect_right(LIST,N)]def GE(LIST,N): return LIST[bisect.bisect_left(LIST,N)]def bitA(X,A):return X & 1<<A == 1<<Adef gtoi(x,y,h,w):return x*w+yimport mathimport bisectimport heapqimport timeimport random as rdimport itertoolsfrom copy import copy as ccfrom copy import deepcopy as dcfrom itertools import accumulate, productfrom collections import Counter, defaultdict, dequedef ceil(U,V):return (U+V-1)//Vdef modf1(N,MOD):return (N-1)%MOD+1def printmat(list):for i in list:print(*i)m4 = [[1,0],[0,1],[-1,0],[0,-1]]m8 = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]inf = (1<<63)-1mod = 998244353n = int(input())omote = []ura = []max_limit = 50for i in range(n):a,b = mp()omote.append(a)ura.append(b)def output(sosa_arr):print(len(sosa_arr))for i,j in sosa_arr:print(i+1,j+1)def calc_score(x,y):return max(abs(5*10**17-x),abs(5*10**17-y))def calc_all_score(a,b,X):ErrorA = abs(500000000000000000 - a[0])ErrorB = abs(500000000000000000 - b[0])Score = (int)(2000000.0 - 100000.0 * math.log10(1.0 * max(ErrorA, ErrorB) + 1.0))if ErrorA == 0 and ErrorB == 0:Score = 2000050 - Xreturn Scoredef greedy(a,b):sosa = []for kaisu in range(max_limit):score = calc_score(a[0],b[0])choose_card = 0for i in range(1,n):na,nb = (a[0]+a[i])/2, (b[0]+b[i])/2now_score = calc_score(na,nb)if now_score < score:score = now_scorechoose_card = ia[0],b[0],a[choose_card],b[choose_card] = (a[0]+a[choose_card])/2, (b[0]+b[choose_card])/2,\(a[0]+a[choose_card])/2, (b[0]+b[choose_card])/2if choose_card == 0:breaksosa.append([0,choose_card])return a,b,sosadef main():na,nb,sosa_arr = greedy(omote,ura)output(sosa_arr)main()