結果
問題 | No.5020 Averaging |
ユーザー | ra5anchor |
提出日時 | 2024-04-06 20:13:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 980 ms / 1,000 ms |
コード長 | 2,414 bytes |
コンパイル時間 | 382 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 82,084 KB |
スコア | 19,386,537 |
最終ジャッジ日時 | 2024-04-06 20:14:06 |
合計ジャッジ時間 | 51,710 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 958 ms
81,828 KB |
testcase_01 | AC | 955 ms
82,084 KB |
testcase_02 | AC | 980 ms
81,956 KB |
testcase_03 | AC | 960 ms
82,084 KB |
testcase_04 | AC | 957 ms
81,956 KB |
testcase_05 | AC | 955 ms
81,956 KB |
testcase_06 | AC | 955 ms
81,956 KB |
testcase_07 | AC | 957 ms
81,956 KB |
testcase_08 | AC | 954 ms
82,084 KB |
testcase_09 | AC | 958 ms
81,956 KB |
testcase_10 | AC | 956 ms
81,956 KB |
testcase_11 | AC | 970 ms
81,956 KB |
testcase_12 | AC | 959 ms
81,956 KB |
testcase_13 | AC | 955 ms
81,956 KB |
testcase_14 | AC | 959 ms
81,956 KB |
testcase_15 | AC | 957 ms
82,084 KB |
testcase_16 | AC | 956 ms
81,956 KB |
testcase_17 | AC | 956 ms
81,956 KB |
testcase_18 | AC | 962 ms
81,956 KB |
testcase_19 | AC | 956 ms
81,956 KB |
testcase_20 | AC | 973 ms
82,084 KB |
testcase_21 | AC | 959 ms
81,956 KB |
testcase_22 | AC | 956 ms
81,956 KB |
testcase_23 | AC | 957 ms
81,956 KB |
testcase_24 | AC | 959 ms
82,084 KB |
testcase_25 | AC | 958 ms
81,956 KB |
testcase_26 | AC | 958 ms
82,084 KB |
testcase_27 | AC | 963 ms
81,956 KB |
testcase_28 | AC | 959 ms
81,956 KB |
testcase_29 | AC | 955 ms
81,956 KB |
testcase_30 | AC | 958 ms
81,956 KB |
testcase_31 | AC | 961 ms
81,956 KB |
testcase_32 | AC | 956 ms
81,956 KB |
testcase_33 | AC | 955 ms
81,956 KB |
testcase_34 | AC | 969 ms
81,956 KB |
testcase_35 | AC | 960 ms
82,084 KB |
testcase_36 | AC | 956 ms
82,084 KB |
testcase_37 | AC | 958 ms
81,956 KB |
testcase_38 | AC | 967 ms
81,956 KB |
testcase_39 | AC | 956 ms
81,956 KB |
testcase_40 | AC | 956 ms
81,956 KB |
testcase_41 | AC | 954 ms
81,956 KB |
testcase_42 | AC | 957 ms
81,956 KB |
testcase_43 | AC | 959 ms
81,956 KB |
testcase_44 | AC | 957 ms
81,956 KB |
testcase_45 | AC | 955 ms
81,956 KB |
testcase_46 | AC | 957 ms
81,956 KB |
testcase_47 | AC | 972 ms
81,956 KB |
testcase_48 | AC | 958 ms
81,956 KB |
testcase_49 | AC | 960 ms
81,956 KB |
ソースコード
import copy import random from time import perf_counter import argparse import sys import math class TimeKeeper: def __init__(self): self.start_time = perf_counter() def is_time_over(self, LIMIT): return (perf_counter() - self.start_time) >= LIMIT def time_now(self): return (perf_counter() - self.start_time) def calscore(ans, C0): C = C0[:] X = len(ans) sc = 0 for i in range(X): u, v = ans[i] a0, b0 = C[u] a1, b1 = C[v] C[u] = (a0 + a1)//2, (b0 + b1)//2 C[v] = (a0 + a1)//2, (b0 + b1)//2 V1 = abs(C[0][0] - 5*10**17) V2 = abs(C[0][1] - 5*10**17) sc = int(2*10**6 - 10**5 * math.log10(max(V1, V2) + 1)) return sc ########################################### def main(DEBUG): tk = TimeKeeper() if DEBUG == True: LIMIT = 0.85 else: LIMIT = 0.85 def output(ans): print(len(ans)) for i in range(len(ans)): u, v = ans[i] u += 1 v += 1 print(u, v) return def solve(LIMIT): C = C0[:] ans = [] a0 = C[0][0] b0 = C[0][1] V1 = abs(a0 - 5*10**17) V2 = abs(b0 - 5*10**17) nowV = max(V1, V2) while len(ans) < 50: if tk.is_time_over(LIMIT): break for i in range(1, N): ai, bi = C[i][0], C[i][1] nxV1 = abs((a0 + ai) // 2 - 5*10**17) nxV2 = abs((b0 + bi) // 2 - 5*10**17) nxtV = max(nxV1, nxV2) if nxtV < nowV: nowV = nxtV a0 = (a0 + ai) // 2 b0 = (b0 + bi) // 2 C[i] = (a0, b0) ans.append((0, i)) sc = int(2*10**6 - 10**5 * math.log10(nowV + 1)) print(sc, nowV, a0, b0, file=sys.stderr) return ans N = int(input()) C0 = [] for i in range(N): a, b = map(int, input().split()) C0.append((a, b)) ans = solve(LIMIT) sc = calscore(ans, C0) print("SC", sc, file=sys.stderr) output(ans) return if __name__ == '__main__': parser = argparse.ArgumentParser(description='Debug mode') parser.add_argument('--debug', action='store_true', help='Enable debug mode') args = parser.parse_args() main(args.debug)