結果
問題 | No.869 ふたつの距離 |
ユーザー | maspy |
提出日時 | 2020-05-14 14:57:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,806 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 44,860 KB |
最終ジャッジ日時 | 2024-09-15 07:07:23 |
合計ジャッジ時間 | 61,746 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 509 ms
44,216 KB |
testcase_01 | AC | 520 ms
44,208 KB |
testcase_02 | AC | 510 ms
44,216 KB |
testcase_03 | AC | 503 ms
43,964 KB |
testcase_04 | AC | 503 ms
44,212 KB |
testcase_05 | AC | 507 ms
44,088 KB |
testcase_06 | AC | 513 ms
44,092 KB |
testcase_07 | AC | 506 ms
43,836 KB |
testcase_08 | AC | 505 ms
44,080 KB |
testcase_09 | AC | 504 ms
43,832 KB |
testcase_10 | AC | 504 ms
44,348 KB |
testcase_11 | AC | 510 ms
44,344 KB |
testcase_12 | AC | 501 ms
44,348 KB |
testcase_13 | AC | 497 ms
44,220 KB |
testcase_14 | AC | 498 ms
43,828 KB |
testcase_15 | AC | 508 ms
44,212 KB |
testcase_16 | AC | 504 ms
44,224 KB |
testcase_17 | AC | 502 ms
44,092 KB |
testcase_18 | AC | 515 ms
43,832 KB |
testcase_19 | AC | 512 ms
43,840 KB |
testcase_20 | AC | 507 ms
43,960 KB |
testcase_21 | AC | 498 ms
44,100 KB |
testcase_22 | AC | 507 ms
43,964 KB |
testcase_23 | AC | 495 ms
43,964 KB |
testcase_24 | AC | 496 ms
44,212 KB |
testcase_25 | AC | 497 ms
44,480 KB |
testcase_26 | AC | 496 ms
44,092 KB |
testcase_27 | AC | 501 ms
44,084 KB |
testcase_28 | AC | 502 ms
44,472 KB |
testcase_29 | AC | 505 ms
44,212 KB |
testcase_30 | AC | 506 ms
44,088 KB |
testcase_31 | AC | 488 ms
44,212 KB |
testcase_32 | AC | 501 ms
43,960 KB |
testcase_33 | AC | 498 ms
44,212 KB |
testcase_34 | AC | 516 ms
43,968 KB |
testcase_35 | AC | 509 ms
44,220 KB |
testcase_36 | AC | 508 ms
43,828 KB |
testcase_37 | AC | 508 ms
43,944 KB |
testcase_38 | AC | 511 ms
43,972 KB |
testcase_39 | AC | 501 ms
43,836 KB |
testcase_40 | AC | 508 ms
43,956 KB |
testcase_41 | AC | 506 ms
44,032 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | WA | - |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | WA | - |
testcase_93 | AC | 502 ms
43,832 KB |
testcase_94 | WA | - |
ソースコード
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def solve_1d(N, A): A0 = A n = (N + 1) // 2 m = N - n A -= n * (n - 1) // 2 + m * (m - 1) // 2 assert A >= 0 x = np.linspace(0, 1, n + 1)[::-1] dx = 1 / (n + n) y = [] for i in range(m): t = min(n, A) A -= t y.append(10 + x[t] + dx) x = np.concatenate([x[:-1], y]) assert len(x) == N cnt = 0 for i in range(N): cnt += np.sum(np.abs(x[i] - x[i + 1:]) < 10) assert cnt == A0 return x def other_points(M): x = np.linspace(100, 90000, M) y = np.zeros_like(x) return x, y def solve(N, A, B): left = 0 # B 未満 right = N # B以上 while left + 1 < right: x = (left + right) // 2 if x * (x - 1) // 2 >= B: right = x else: left = x n = right x0, y0 = other_points(N - n) t = solve_1d(n - 1, A) theta = t / 20 x = np.cos(theta) * 20 y = np.sin(theta) * 20 far = n * (n - 1) // 2 - B eps = 1e-7 x[:far] *= (1 + eps) y[:far] *= (1 + eps) x[far:] *= (1 - eps) y[far:] *= (1 - eps) x = np.concatenate([[0], x, x0]) y = np.concatenate([[0], y, y0]) return x, y N, A, B = map(int, read().split()) x, y = solve(N, A, B) def check(N, A, B, x, y): assert len(x) == len(y) == N dx = np.subtract.outer(x, x) dy = np.subtract.outer(y, y) d = (dx * dx + dy * dy)**.5 np.fill_diagonal(d, 30) n1 = np.count_nonzero(d <= 10) // 2 n2 = np.count_nonzero(d <= 20) // 2 assert n1 == A assert n2 == B # check(N, A, B, x, y) x, y = solve(N, A, B) xy = np.vstack([x, y]).T print('\n'.join(' '.join(row) for row in xy.astype(str)))