結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー karinohitokarinohito
提出日時 2021-09-07 00:52:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 415 ms / 5,000 ms
コード長 729 bytes
コンパイル時間 1,811 ms
コンパイル使用メモリ 172,416 KB
実行使用メモリ 9,736 KB
最終ジャッジ日時 2023-08-24 13:17:10
合計ジャッジ時間 14,727 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 415 ms
9,696 KB
testcase_01 AC 414 ms
9,704 KB
testcase_02 AC 412 ms
9,508 KB
testcase_03 AC 412 ms
9,736 KB
testcase_04 AC 411 ms
9,672 KB
testcase_05 AC 413 ms
9,704 KB
testcase_06 AC 410 ms
9,020 KB
testcase_07 AC 409 ms
9,352 KB
testcase_08 AC 401 ms
8,996 KB
testcase_09 AC 403 ms
9,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;
ll mod=1e9+7;

int main() {
    ll N;
    cin>>N;
    vector<double> L(N);
    priority_queue<pair<double,ll>> Q;
    rep(i,N){

      cin>>L[i];
      Q.push(make_pair(L[i],1));
    }
    vector<double> AN(500005);
    rep(i,500003){
      auto p=Q.top();
      Q.pop();
      AN[i+1]=p.first;
      Q.push(make_pair(p.first*double(p.second)/double(p.second+1),p.second+1));
    }
    ll q;
    cin>>q;
    cout<<setprecision(16);
    rep(i,q){
      ll K;
      cin>>K;
      cout<<AN[K]<<endl;
    }
}
0