結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー |
|
提出日時 | 2017-06-13 17:26:03 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 582 ms / 5,000 ms |
コード長 | 884 bytes |
コンパイル時間 | 2,825 ms |
コンパイル使用メモリ | 179,236 KB |
実行使用メモリ | 24,392 KB |
最終ジャッジ日時 | 2024-06-12 20:02:22 |
合計ジャッジ時間 | 16,211 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, core.stdc.stdio;void main() {auto N = readln.chomp.to!int;auto L = readln.split.map!(to!long).array;auto Q = readln.chomp.to!int;auto K = readln.split.map!(to!int).array;auto M = new int[](N);auto pq = new BinaryHeap!(Array!(Tuple!(real, int)), "a[0] < b[0]");foreach (i; 0..N) pq.insert(tuple(L[i].to!real, i));auto ans = new real[](5*10^^5+1);ans[0] = 1L << 60;foreach (i; 1..5*10^^5+1) {auto t = pq.front;pq.popFront;ans[i] = min(ans[i-1], t[0]);M[t[1]] += 1;pq.insert(tuple(1.0L * L[t[1]] / (M[t[1]] + 1), t[1]));}foreach (i; 0..Q) {writefln("%.10f", ans[K[i]]);}}