結果
問題 | No.869 ふたつの距離 |
ユーザー | maspy |
提出日時 | 2020-05-14 15:08:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 528 ms / 1,500 ms |
コード長 | 1,347 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,676 KB |
最終ジャッジ日時 | 2024-09-15 07:23:16 |
合計ジャッジ時間 | 53,141 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 516 ms
44,036 KB |
testcase_01 | AC | 520 ms
44,036 KB |
testcase_02 | AC | 503 ms
43,920 KB |
testcase_03 | AC | 517 ms
44,556 KB |
testcase_04 | AC | 520 ms
44,420 KB |
testcase_05 | AC | 520 ms
44,288 KB |
testcase_06 | AC | 514 ms
44,168 KB |
testcase_07 | AC | 515 ms
44,176 KB |
testcase_08 | AC | 507 ms
44,140 KB |
testcase_09 | AC | 506 ms
44,516 KB |
testcase_10 | AC | 510 ms
44,164 KB |
testcase_11 | AC | 514 ms
44,416 KB |
testcase_12 | AC | 515 ms
44,044 KB |
testcase_13 | AC | 512 ms
43,908 KB |
testcase_14 | AC | 528 ms
44,292 KB |
testcase_15 | AC | 520 ms
44,036 KB |
testcase_16 | AC | 511 ms
44,544 KB |
testcase_17 | AC | 512 ms
44,032 KB |
testcase_18 | AC | 510 ms
44,552 KB |
testcase_19 | AC | 503 ms
44,048 KB |
testcase_20 | AC | 503 ms
44,164 KB |
testcase_21 | AC | 505 ms
44,032 KB |
testcase_22 | AC | 516 ms
44,172 KB |
testcase_23 | AC | 511 ms
43,916 KB |
testcase_24 | AC | 517 ms
44,424 KB |
testcase_25 | AC | 510 ms
44,556 KB |
testcase_26 | AC | 508 ms
44,416 KB |
testcase_27 | AC | 505 ms
44,296 KB |
testcase_28 | AC | 498 ms
44,548 KB |
testcase_29 | AC | 500 ms
44,420 KB |
testcase_30 | AC | 505 ms
44,416 KB |
testcase_31 | AC | 518 ms
44,428 KB |
testcase_32 | AC | 520 ms
44,288 KB |
testcase_33 | AC | 515 ms
44,544 KB |
testcase_34 | AC | 521 ms
44,416 KB |
testcase_35 | AC | 511 ms
44,292 KB |
testcase_36 | AC | 503 ms
44,296 KB |
testcase_37 | AC | 502 ms
44,420 KB |
testcase_38 | AC | 518 ms
44,036 KB |
testcase_39 | AC | 514 ms
43,908 KB |
testcase_40 | AC | 522 ms
44,420 KB |
testcase_41 | AC | 513 ms
44,164 KB |
testcase_42 | AC | 519 ms
44,420 KB |
testcase_43 | AC | 513 ms
43,908 KB |
testcase_44 | AC | 512 ms
44,672 KB |
testcase_45 | AC | 516 ms
44,420 KB |
testcase_46 | AC | 503 ms
44,296 KB |
testcase_47 | AC | 508 ms
44,292 KB |
testcase_48 | AC | 518 ms
44,424 KB |
testcase_49 | AC | 515 ms
44,420 KB |
testcase_50 | AC | 515 ms
44,032 KB |
testcase_51 | AC | 522 ms
44,008 KB |
testcase_52 | AC | 517 ms
44,032 KB |
testcase_53 | AC | 514 ms
44,044 KB |
testcase_54 | AC | 511 ms
44,416 KB |
testcase_55 | AC | 515 ms
44,040 KB |
testcase_56 | AC | 518 ms
44,032 KB |
testcase_57 | AC | 510 ms
44,292 KB |
testcase_58 | AC | 509 ms
44,032 KB |
testcase_59 | AC | 519 ms
44,036 KB |
testcase_60 | AC | 515 ms
44,044 KB |
testcase_61 | AC | 522 ms
44,424 KB |
testcase_62 | AC | 514 ms
44,548 KB |
testcase_63 | AC | 505 ms
44,416 KB |
testcase_64 | AC | 508 ms
44,292 KB |
testcase_65 | AC | 511 ms
44,292 KB |
testcase_66 | AC | 522 ms
44,296 KB |
testcase_67 | AC | 518 ms
44,288 KB |
testcase_68 | AC | 521 ms
43,908 KB |
testcase_69 | AC | 515 ms
44,032 KB |
testcase_70 | AC | 523 ms
44,416 KB |
testcase_71 | AC | 513 ms
44,416 KB |
testcase_72 | AC | 511 ms
44,160 KB |
testcase_73 | AC | 513 ms
44,168 KB |
testcase_74 | AC | 525 ms
44,288 KB |
testcase_75 | AC | 512 ms
44,036 KB |
testcase_76 | AC | 519 ms
44,420 KB |
testcase_77 | AC | 514 ms
44,036 KB |
testcase_78 | AC | 512 ms
44,352 KB |
testcase_79 | AC | 505 ms
44,676 KB |
testcase_80 | AC | 514 ms
43,944 KB |
testcase_81 | AC | 507 ms
44,424 KB |
testcase_82 | AC | 511 ms
44,292 KB |
testcase_83 | AC | 521 ms
44,412 KB |
testcase_84 | AC | 527 ms
44,552 KB |
testcase_85 | AC | 518 ms
44,032 KB |
testcase_86 | AC | 521 ms
44,424 KB |
testcase_87 | AC | 517 ms
43,904 KB |
testcase_88 | AC | 521 ms
44,420 KB |
testcase_89 | AC | 519 ms
44,424 KB |
testcase_90 | AC | 509 ms
44,416 KB |
testcase_91 | AC | 515 ms
44,424 KB |
testcase_92 | AC | 516 ms
43,908 KB |
testcase_93 | AC | 518 ms
44,292 KB |
testcase_94 | AC | 509 ms
44,040 KB |
ソースコード
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def solve_on_circ(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, 0.1, n + 1)[::-1] dx = 0.1 / (n + n) y = [] phi = 2 * np.arcsin(0.25) for i in range(m): t = min(n, A) A -= t y.append(phi + x[t] + dx) t = np.concatenate([x[:-1], y]) x = 20 * np.cos(t) y = 20 * np.sin(t) return x, y 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) x, y = solve_on_circ(n - 1, A) 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) xy = np.vstack([x, y]).T print('\n'.join(' '.join(row) for row in xy.astype(str)))