結果

問題 No.5020 Averaging
ユーザー ゆ
提出日時 2024-02-25 13:35:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 891 ms / 1,000 ms
コード長 870 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,768 KB
スコア 19,156,183
最終ジャッジ日時 2024-02-25 13:35:59
合計ジャッジ時間 47,527 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 887 ms
76,636 KB
testcase_01 AC 886 ms
76,484 KB
testcase_02 AC 887 ms
76,488 KB
testcase_03 AC 887 ms
76,488 KB
testcase_04 AC 887 ms
76,492 KB
testcase_05 AC 887 ms
76,716 KB
testcase_06 AC 886 ms
76,492 KB
testcase_07 AC 887 ms
76,720 KB
testcase_08 AC 886 ms
76,660 KB
testcase_09 AC 886 ms
76,744 KB
testcase_10 AC 887 ms
76,484 KB
testcase_11 AC 886 ms
76,492 KB
testcase_12 AC 887 ms
76,656 KB
testcase_13 AC 887 ms
76,652 KB
testcase_14 AC 888 ms
76,636 KB
testcase_15 AC 887 ms
76,652 KB
testcase_16 AC 886 ms
76,364 KB
testcase_17 AC 886 ms
76,616 KB
testcase_18 AC 887 ms
76,492 KB
testcase_19 AC 887 ms
76,636 KB
testcase_20 AC 887 ms
76,492 KB
testcase_21 AC 887 ms
76,644 KB
testcase_22 AC 887 ms
76,748 KB
testcase_23 AC 886 ms
76,364 KB
testcase_24 AC 891 ms
76,620 KB
testcase_25 AC 888 ms
76,640 KB
testcase_26 AC 887 ms
76,760 KB
testcase_27 AC 888 ms
76,364 KB
testcase_28 AC 888 ms
76,648 KB
testcase_29 AC 888 ms
76,620 KB
testcase_30 AC 890 ms
76,620 KB
testcase_31 AC 888 ms
76,640 KB
testcase_32 AC 887 ms
76,636 KB
testcase_33 AC 887 ms
76,640 KB
testcase_34 AC 887 ms
76,728 KB
testcase_35 AC 887 ms
76,620 KB
testcase_36 AC 887 ms
76,724 KB
testcase_37 AC 886 ms
76,364 KB
testcase_38 AC 887 ms
76,660 KB
testcase_39 AC 887 ms
76,492 KB
testcase_40 AC 885 ms
76,768 KB
testcase_41 AC 888 ms
76,644 KB
testcase_42 AC 886 ms
76,660 KB
testcase_43 AC 887 ms
76,640 KB
testcase_44 AC 887 ms
76,492 KB
testcase_45 AC 887 ms
76,492 KB
testcase_46 AC 887 ms
76,364 KB
testcase_47 AC 887 ms
76,724 KB
testcase_48 AC 887 ms
76,636 KB
testcase_49 AC 887 ms
76,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from time import time
start = time()
import sys,math
from random import randint,randrange,sample,shuffle,choice
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def ms(): return map(int, input().split())
def li(): return list(map(int,input().split()))
# ////////////////////////////////
N = ii()
A = list()
B = list()
for i in range(N):
  a,b = ms()
  A.append([a,i])
  B.append([b,i])
NUM = [i for i in range(2,N)]
STAND = 5*pow(10,17)
TURN = 0
V1,V2 = abs(A[0][0]-STAND),abs(B[0][0]-STAND)
ANS = list()
while TURN<50:
  if time()-start>0.85: break
  v = choice(NUM)
  na,nb = (A[0][0]+A[v][0])//2,(B[0][0]+B[v][0])//2
  n1,n2 = abs(na-STAND),abs(nb-STAND)
  if max(n1,n2)>=max(V1,V2): continue
  ANS.append((1,v+1))
  V1,V2 = n1,n2
  A[0][0],A[v][0],B[0][0],B[v][0] = na,na,nb,nb
  TURN += 1
  
print(len(ANS))
for u,v in ANS: print(u,v)
0