結果
問題 |
No.1905 PURE PHRASE
|
ユーザー |
![]() |
提出日時 | 2022-04-15 22:57:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 638 bytes |
コンパイル時間 | 332 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 15,624 KB |
最終ジャッジ日時 | 2024-12-25 02:08:50 |
合計ジャッジ時間 | 4,265 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 14 |
ソースコード
from bisect import bisect_left n = int(input()) a = list(map(int, input().split())) r = sorted(a)[-500] s = sorted(a)[500] p = [] q = [] for i, v in enumerate(a): if v > r and (not p or p[-1] < i-50): p.append(i) if v < s and (not q or q[-1] < i-50): q.append(i) d = [p[i+1]-p[i] for i in range(len(p)-1)] e = [q[i+1]-q[i] for i in range(len(q)-1)] l = len(d)//3 m = len(e)//3 c = n/max(sum(sorted(d)[l:2*l])/l, sum(sorted(e)[m:2*m])/m) h = ["C4", "D4", "E4", "F4", "G4", "A4", "B4"] f = [261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5] i = bisect_left(f, c) if i > 5: i = 5 print(h[i] if abs(c-f[i]) < abs(c-f[i+1]) else h[i+1])