結果
問題 | No.5020 Averaging |
ユーザー |
![]() |
提出日時 | 2024-02-25 16:26:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 943 ms / 1,000 ms |
コード長 | 1,333 bytes |
コンパイル時間 | 259 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 84,256 KB |
スコア | 29,678,440 |
最終ジャッジ日時 | 2024-02-25 16:26:54 |
合計ジャッジ時間 | 50,040 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
import sysinput = sys.stdin.readlinefrom random import randintfrom time import timetime0=time()N=int(input())A=[list(map(int,input().split())) for i in range(N)]A_INI=[]for a,b in A:A_INI.append([a,b])LANS=[]score=10**18while time()-time0<0.9:ANS=[]A=[]for a,b in A_INI:A.append([a,b])for i in range(49):while True:x,y=randint(0,N-1),randint(0,N-1)if x==y:continueelse:breakc=(A[x][0]+A[y][0])//2d=(A[x][1]+A[y][1])//2A[x][0]=A[y][0]=cA[x][1]=A[y][1]=dANS.append(x)ANS.append(y)if x!=0:c0=(A[0][0]+A[x][0])//2d0=(A[0][1]+A[x][1])//2if max(abs(5*(10**17)-c0),abs(5*(10**17)-d0))<score:score=max(abs(5*(10**17)-c0),abs(5*(10**17)-d0))LANS=ANS[:]+[0]+[x]if y!=0:c0=(A[0][0]+A[y][0])//2d0=(A[0][1]+A[y][1])//2if max(abs(5*(10**17)-c0),abs(5*(10**17)-d0))<score:score=max(abs(5*(10**17)-c0),abs(5*(10**17)-d0))LANS=ANS[:]+[0]+[y]print(len(LANS)//2)for i in range(0,len(LANS),2):print(LANS[i]+1,LANS[i+1]+1)