結果
| 問題 | No.68 よくある棒を切る問題 (2) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-06-13 17:22:49 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 826 bytes | 
| コンパイル時間 | 2,446 ms | 
| コンパイル使用メモリ | 183,972 KB | 
| 実行使用メモリ | 24,200 KB | 
| 最終ジャッジ日時 | 2024-06-12 20:01:31 | 
| 合計ジャッジ時間 | 11,552 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 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;
    L.sort();
    auto pq = new BinaryHeap!(Array!(Tuple!(real, int)), "a < b");
    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]);
        pq.insert(tuple(1.0L * L[t[1]] / (i + 1), t[1]));
    }
    
    foreach (i; 0..Q) {
        ans[K[i]].writeln;
    }
}
            
            
            
        