結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-10 15:24:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 527 ms / 5,000 ms
コード長 1,416 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 205,480 KB
実行使用メモリ 17,912 KB
最終ジャッジ日時 2023-09-01 23:04:21
合計ジャッジ時間 16,101 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 504 ms
17,364 KB
testcase_01 AC 505 ms
17,912 KB
testcase_02 AC 507 ms
17,480 KB
testcase_03 AC 527 ms
17,328 KB
testcase_04 AC 511 ms
17,444 KB
testcase_05 AC 509 ms
17,612 KB
testcase_06 AC 494 ms
16,484 KB
testcase_07 AC 498 ms
16,900 KB
testcase_08 AC 481 ms
15,980 KB
testcase_09 AC 490 ms
16,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=2e9+1;
const ll INF=4e18;
const ll dy[8]={-1,0,1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}

int main(){
  ll n;cin >> n;
  using ld=long double;
  vector<ld> v(n);rep(i,n)cin >> v[i];
  vector<ld> cut(n,1);
  priority_queue<pair<ld,ll>> que;
  rep(i,n)que.push({v[i],i});
  vector<ld> ans(500010);
  for(int i=1;i<=500000;i++){
    ans[i]=que.top().first;
    ll idx=que.top().second;
    que.pop();
    cut[idx]++;
    que.push({v[idx]/cut[idx],idx});
  }
  CST(10);
  ll q;cin >> q;
  while(q--){
    ll k;cin >> k;cout << ans[k] << endl;
  }
}     
0