結果
問題 | No.5020 Averaging |
ユーザー |
|
提出日時 | 2024-02-25 15:33:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 942 ms / 1,000 ms |
コード長 | 1,509 bytes |
コンパイル時間 | 345 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 78,284 KB |
スコア | 17,204,134 |
最終ジャッジ日時 | 2024-02-25 15:34:30 |
合計ジャッジ時間 | 50,110 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#int(input())#map(int, input().split())#list(map(int, input().split()))import timeimport randomfrom math import floor, log10N = int(input())u = [0] * (2 * N)for i in range(N):a, b = map(int, input().split())u[i] = au[i+N] = but = time.time()def get_score(u):c = 5 * 10 ** 17v1 = abs(u[0] - c)v2 = abs(u[N] - c)s = floor(2 * 10 ** 6 - 10 ** 5 * log10(max(v1, v2) + 1))return sM = 50ans = [0] * (2 * M)for i in range(2*M):ans[i] = random.randint(0, N-1)# for i in range(10):# ans[i] = 0def f(a):nu = list(u)for i in range(M):if a[i] == a[i+M]:continuex = a[i]y = a[i+M]nu[x] = floor((nu[x]+nu[y]) / 2)nu[y] = nu[x]nu[x+N] = floor((nu[x+N]+nu[y+N]) / 2)nu[y+N] = nu[y+N]return nunows = get_score(f(ans))count = 0while time.time() - ut < 0.9:nans = list(ans)t = random.randint(0, 2*M-1)n = random.randint(0, N-1)nans[t] = ns = get_score(f(nans))if s > nows:ans = list(nans)# print(s, nows)nows = scount += 1fa = f(ans)# print(count)# print(fa[:3], fa[N:N+3])def stdout(ans):l = []for i in range(M):if ans[i] == ans[i+M]:continuel.append([ans[i]+1, ans[i+M]+1])# f = open("out.txt", "w")# print(len(l), file=f)# for x in l:# print(*x, file=f)print(len(l))for x in l:print(*x)stdout(ans)