結果

問題 No.68 よくある棒を切る問題 (2)
ユーザー chocoruskchocorusk
提出日時 2018-09-28 13:14:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 447 ms / 5,000 ms
コード長 800 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 90,780 KB
実行使用メモリ 10,656 KB
最終ジャッジ日時 2024-04-20 09:21:59
合計ジャッジ時間 12,000 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 446 ms
10,652 KB
testcase_01 AC 433 ms
10,656 KB
testcase_02 AC 437 ms
10,652 KB
testcase_03 AC 441 ms
10,656 KB
testcase_04 AC 445 ms
10,656 KB
testcase_05 AC 447 ms
10,652 KB
testcase_06 AC 422 ms
10,524 KB
testcase_07 AC 438 ms
10,656 KB
testcase_08 AC 416 ms
10,564 KB
testcase_09 AC 424 ms
10,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<double, int> Pd;
int main()
{
	int n;
	cin>>n;
	double l[100000];
	priority_queue<Pd> que;
	for(int i=0; i<n; i++){
		cin>>l[i];
		que.push(Pd(l[i], i));
	}
	int ct[100000]={};
	double ans[500001];
	for(int t=1; t<=500000; t++){
		Pd p=que.top(); que.pop();
		ans[t]=p.first;
		int i=p.second;
		ct[i]++;
		que.push(Pd(l[i]/((double)(ct[i]+1)), i));
	}
	int q;
	cin>>q;
	for(int i=0; i<q; i++){
		int k; cin>>k;
		printf("%.10lf\n", ans[k]);
	}
	return 0;
}
0