結果
問題 | No.5020 Averaging |
ユーザー | Mao-beta |
提出日時 | 2024-02-25 15:04:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,722 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 81,828 KB |
実行使用メモリ | 58,084 KB |
スコア | 0 |
最終ジャッジ日時 | 2024-02-25 15:04:57 |
合計ジャッジ時間 | 4,598 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
ソースコード
import sys import math import bisect from heapq import heapify, heappop, heappush from collections import deque, defaultdict, Counter from functools import lru_cache from itertools import accumulate, combinations, permutations, product sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD99 = 998244353 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() SMI = lambda: input().split() SLI = lambda: list(SMI()) EI = lambda m: [NLI() for _ in range(m)] def score(a, b, x): v1 = abs(5 * 10**17 - a) v2 = abs(5 * 10**17 - b) # print("#", v1, v2) if max(v1, v2) > 0: return int(2000000 - 100000 * math.log10(max(v1, v2)+1)) else: return 2000050 - x def answer(ans): print(len(ans)) for i, j in ans: print(i+1, j+1) def main(): N = NI() AB = EI(N) ans = [] # 0と何かだけで貪欲 for qi in range(50): a0, b0 = AB[0] s = score(a0, b0, qi) print(s) best_s = s best_v = 1 for v in range(1, N): av, bv = AB[v] na, nb = (a0+av) // 2, (b0+bv) // 2 ns = score(na, nb, qi+1) # print(na, nb, ns) if ns > best_s: # print("##") best_s = ns best_v = v # print(s) # print(best_s) if best_s > s: av, bv = AB[best_v] na, nb = (a0 + av) // 2, (b0 + bv) // 2 AB[0] = [na, nb] AB[best_v] = [na, nb] ans.append([0, best_v]) else: break answer(ans) if __name__ == "__main__": main()