結果

問題 No.475 最終日 - Writerの怠慢
ユーザー suppy193
提出日時 2017-02-10 16:00:36
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 900 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 19,584 KB
最終ジャッジ日時 2024-12-26 18:16:02
合計ジャッジ時間 4,537 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, s, w_id = gets.strip.split(' ').map(&:to_i)
a = gets.strip.split(' ').map(&:to_i)
scores = []
(1..n - 1).each do |i|
	scores << (50 * s + 50 * s / (0.8 + 0.2 * i)).floor	
end
score_writer = a[w_id] + 100 * s
pro = 1
(0...n).each do |id|
	next if id == w_id
=begin
	count = 0
	scores.each do |score|
		if a[id] + score > score_writer
			count += 1
		else
			break
		end
	end
	p count
=end
	idx_min = 0
	idx_max = n - 2
	idx = 0
	# 3.times do
	if a[id] + scores[0] < score_writer
		count = 0
	else
		loop do
			idx = (idx_max + idx_min) / 2
			# print "id:#{id} #{idx_min} #{idx_max} #{a[id] + scores[idx]} #{score_writer} #{scores}\n"
			if a[id] + scores[idx] >= score_writer
				idx_min = idx
			else
				idx_max = idx
			end
			# print "id:#{id} #{idx_min} #{idx_max}\n"
			break if idx_max - idx_min <= 1
		end
		count = idx_max
	end
	# p count
	pro *= (n - 1 - count).to_f / (n - 1)
end

p pro
0