結果
| 問題 | No.5020 Averaging | 
| コンテスト | |
| ユーザー |  kumk | 
| 提出日時 | 2024-02-25 13:47:41 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,503 bytes | 
| コンパイル時間 | 329 ms | 
| コンパイル使用メモリ | 81,700 KB | 
| 実行使用メモリ | 66,780 KB | 
| スコア | 0 | 
| 最終ジャッジ日時 | 2024-02-25 13:48:00 | 
| 合計ジャッジ時間 | 4,934 ms | 
| ジャッジサーバーID (参考情報) | judge12 / judge14 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 50 | 
ソースコード
import sys
import math
import io
import sys
TARGET = 5*10**17
def cal_score(v1, v2):
    sa = max(abs(v1-TARGET),abs(v2-TARGET))
    return 2 * 10**6 - 10**5 * math.log10(sa +1)
def cal_ave(A,B, i,j):
    A[i] = (A[i] + A[j])//2
    A[j] = A[i]
    B[i] = (B[i] + B[j])//2
    B[j] = B[i]    
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())
    # 出力
    print(50)
    for i in range(2, 50 + 1):
        now_score = cal_score(A[1],B[1])
        kouho = (1,1)
        for i in range(2, N + 1):
#            print("1 " + str(i))
            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)
        cal_ave(A,B,1,kouho[1])
        print("1 " + str(kouho[1]))
        if debug:
            print(cal_score(A[1],B[1]))
if __name__ == "__main__":
    main()
            
            
            
        