結果

問題 No.475 最終日 - Writerの怠慢
ユーザー rpy3cpp
提出日時 2017-01-06 18:02:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,000 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,468 KB
最終ジャッジ日時 2024-12-24 01:41:15
合計ジャッジ時間 2,557 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def read_data():
    N, S, wid = map(int, input().split())
    As = list(map(int, input().split()))
    return N, S, wid, As

def solve(N, S, wid, As):
    writer_score = As[wid] + 100 * S
    As = As[:wid] + As[wid + 1:]
    scores = [50 * S + 250*S//(r + 4) for r in range(N-1, 0, -1)]
    ranks = [find_rank(a, scores, writer_score) for a in As]
    return calc_prob(ranks, N)

def find_rank(a, scores, t):
    '''a + scores[i] <= t となる 最大の i を求める。
    a + scores[i] > t となる最小の i を求めて、i - 1 を返す?
    scores は整数値のリストで昇順に並んでおり、同じ値を複数含みうる。
    '''
    return bisect.bisect_right(scores, t - a) - 1
    

def calc_prob(ranks, N):
    p = 1.0
    ranks.sort()
    for i, r in enumerate(ranks):
        den = N - 1 - i
        num = r + 1 - i
        if num <= 0:
            return 0
        p *= num/den
    return p

    
N, S, wid, As = read_data()
print(solve(N, S, wid, As))
0