結果
問題 | No.1385 Simple Geometry 2 |
ユーザー | LyricalMaestro |
提出日時 | 2024-02-25 03:43:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 327 ms / 500 ms |
コード長 | 1,856 bytes |
コンパイル時間 | 356 ms |
コンパイル使用メモリ | 82,836 KB |
実行使用メモリ | 222,628 KB |
最終ジャッジ日時 | 2024-09-29 10:41:58 |
合計ジャッジ時間 | 26,638 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
53,120 KB |
testcase_01 | AC | 35 ms
52,736 KB |
testcase_02 | AC | 47 ms
52,608 KB |
testcase_03 | AC | 38 ms
54,016 KB |
testcase_04 | AC | 37 ms
53,376 KB |
testcase_05 | AC | 37 ms
53,120 KB |
testcase_06 | AC | 38 ms
53,504 KB |
testcase_07 | AC | 40 ms
53,120 KB |
testcase_08 | AC | 57 ms
66,688 KB |
testcase_09 | AC | 57 ms
67,288 KB |
testcase_10 | AC | 57 ms
67,200 KB |
testcase_11 | AC | 56 ms
67,200 KB |
testcase_12 | AC | 57 ms
67,328 KB |
testcase_13 | AC | 307 ms
218,004 KB |
testcase_14 | AC | 295 ms
218,032 KB |
testcase_15 | AC | 296 ms
218,288 KB |
testcase_16 | AC | 305 ms
218,148 KB |
testcase_17 | AC | 294 ms
218,568 KB |
testcase_18 | AC | 292 ms
217,920 KB |
testcase_19 | AC | 290 ms
217,288 KB |
testcase_20 | AC | 292 ms
217,764 KB |
testcase_21 | AC | 291 ms
218,024 KB |
testcase_22 | AC | 288 ms
216,888 KB |
testcase_23 | AC | 293 ms
218,164 KB |
testcase_24 | AC | 288 ms
216,728 KB |
testcase_25 | AC | 290 ms
216,512 KB |
testcase_26 | AC | 296 ms
218,416 KB |
testcase_27 | AC | 294 ms
218,264 KB |
testcase_28 | AC | 293 ms
216,548 KB |
testcase_29 | AC | 295 ms
218,388 KB |
testcase_30 | AC | 293 ms
218,016 KB |
testcase_31 | AC | 297 ms
218,012 KB |
testcase_32 | AC | 294 ms
218,292 KB |
testcase_33 | AC | 293 ms
217,904 KB |
testcase_34 | AC | 301 ms
217,672 KB |
testcase_35 | AC | 296 ms
217,892 KB |
testcase_36 | AC | 299 ms
218,036 KB |
testcase_37 | AC | 296 ms
218,436 KB |
testcase_38 | AC | 293 ms
217,884 KB |
testcase_39 | AC | 296 ms
218,408 KB |
testcase_40 | AC | 298 ms
218,284 KB |
testcase_41 | AC | 293 ms
217,852 KB |
testcase_42 | AC | 295 ms
218,040 KB |
testcase_43 | AC | 308 ms
218,136 KB |
testcase_44 | AC | 299 ms
218,016 KB |
testcase_45 | AC | 297 ms
217,800 KB |
testcase_46 | AC | 298 ms
218,276 KB |
testcase_47 | AC | 296 ms
219,940 KB |
testcase_48 | AC | 296 ms
218,688 KB |
testcase_49 | AC | 298 ms
218,268 KB |
testcase_50 | AC | 296 ms
217,876 KB |
testcase_51 | AC | 308 ms
218,396 KB |
testcase_52 | AC | 296 ms
218,236 KB |
testcase_53 | AC | 297 ms
217,748 KB |
testcase_54 | AC | 300 ms
217,884 KB |
testcase_55 | AC | 297 ms
218,528 KB |
testcase_56 | AC | 298 ms
218,016 KB |
testcase_57 | AC | 298 ms
217,992 KB |
testcase_58 | AC | 297 ms
218,140 KB |
testcase_59 | AC | 276 ms
189,256 KB |
testcase_60 | AC | 281 ms
217,256 KB |
testcase_61 | AC | 281 ms
217,136 KB |
testcase_62 | AC | 283 ms
217,040 KB |
testcase_63 | AC | 299 ms
221,876 KB |
testcase_64 | AC | 327 ms
222,628 KB |
testcase_65 | AC | 297 ms
221,740 KB |
testcase_66 | AC | 295 ms
221,868 KB |
testcase_67 | AC | 295 ms
217,784 KB |
ソースコード
## https://yukicoder.me/problems/no/1385 import math def main(): N, L = map(int, input().split()) T = list(map(int, input().split())) # sin, cosの累積和 f_list = [0] * N g_list = [0] * N f = 0 g = 0 for i in reversed(range(N)): t = (2 * math.pi * T[i]) / L f += math.sin(t) g += math.cos(t) f_list[i] = f g_list[i] = g # 複雑な計算式の累積和 x_cum_list = [0] * N x_cum = 0 xcos_cum_list = [0] * N xcos_cum = 0 xsin_cum_list = [0] * N xsin_cum = 0 ysin_cum_list = [0] * N ysin_cum = 0 ycos_cum_list = [0] * N ycos_cum = 0 for i in reversed(range(N - 1)): f = f_list[i + 1] g = g_list[i + 1] t = (2 * math.pi * T[i]) / L cos_t = math.cos(t) sin_t = math.sin(t) x = f * cos_t - g * sin_t y = (N - 1 - i) - g * cos_t - f * sin_t x_cum += x x_cum_list[i] = x_cum xcos_cum += x * cos_t xcos_cum_list[i] = xcos_cum xsin_cum += x * sin_t xsin_cum_list[i] = xsin_cum ysin_cum += y * sin_t ysin_cum_list[i] = ysin_cum ycos_cum += y * cos_t ycos_cum_list[i] = ycos_cum # cum_value_list = [0] * N for i in reversed(range(N - 2)): t = (2 * math.pi * T[i]) / L cos_t = math.cos(t) sin_t = math.sin(t) value = x_cum_list[i + 1] / 2 value -= xcos_cum_list[i + 1] * cos_t / 2 value -= xsin_cum_list[i + 1] * sin_t / 2 value += ysin_cum_list[i + 1] * cos_t / 2 value -= ycos_cum_list[i + 1] * sin_t / 2 cum_value_list[i] = value ans = (N * (N - 1) * (N - 2)) // 6 answer = 0 for i in range(N): answer += cum_value_list[i] / ans print(answer) if __name__ == "__main__": main()