結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー 沙耶花沙耶花
提出日時 2021-10-21 22:25:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 402 ms / 5,000 ms
コード長 717 bytes
コンパイル時間 5,788 ms
コンパイル使用メモリ 268,272 KB
実行使用メモリ 9,824 KB
最終ジャッジ日時 2023-10-21 17:55:38
合計ジャッジ時間 16,349 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 396 ms
9,824 KB
testcase_01 AC 396 ms
9,824 KB
testcase_02 AC 395 ms
9,824 KB
testcase_03 AC 402 ms
9,824 KB
testcase_04 AC 396 ms
9,824 KB
testcase_05 AC 397 ms
9,824 KB
testcase_06 AC 387 ms
9,140 KB
testcase_07 AC 393 ms
9,484 KB
testcase_08 AC 382 ms
9,084 KB
testcase_09 AC 385 ms
9,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000

int main(){
	
	int N;
	cin>>N;
	
	vector<long long> L(N);
	rep(i,N)cin>>L[i];
	
	priority_queue<pair<double,int>> Q;
	rep(i,N){
		Q.emplace(L[i],1);
	}
	
	vector<double> ans(500005,0);
	double m = 1e10;
	for(int i=1;i<ans.size();i++){
		auto p = Q.top();
		Q.pop();
		m = min(m,p.first);
		p.first *= p.second;
		p.second++;
		p.first /= p.second;
		Q.push(p);
		ans[i] = m;
	}
	
	
	int _q;
	cin>>_q;
	
	rep(_,_q){
		int K;
		scanf("%d",&K);
		cout<<fixed<<setprecision(10)<<ans[K]<<endl;
	}
	
	return 0;
}
0