結果
| 問題 |
No.68 よくある棒を切る問題 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-19 20:51:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 494 ms / 5,000 ms |
| コード長 | 1,328 bytes |
| コンパイル時間 | 1,937 ms |
| コンパイル使用メモリ | 172,492 KB |
| 実行使用メモリ | 17,804 KB |
| 最終ジャッジ日時 | 2024-10-08 14:31:26 |
| 合計ジャッジ時間 | 14,184 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
#define show(x) cout << #x << " = " << x << endl
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
os << "sz=" << v.size() << "\n[";
for (const auto& p : v) {
os << p << ",";
}
os << "]\n";
return os;
}
template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
os << "(" << p.first << "," << p.second
<< ")";
return os;
}
constexpr ll MOD = 1e9 + 7;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;
constexpr ll MAX = 500000;
long double table[MAX + 1];
int main()
{
ll N;
cin >> N;
using pli = pair<long double, int>;
vector<pli> L(N);
priority_queue<pli> q;
for (ll i = 0; i < N; i++) {
cin >> L[i].first;
L[i].second = 1;
q.push(L[i]);
}
for (ll i = 1; i <= MAX; i++) {
pli p = q.top();
q.pop();
table[i] = p.first;
p.first = p.first * p.second / (p.second + 1);
p.second++;
q.push(p);
}
ll Q;
cin >> Q;
for (ll i = 0; i < Q; i++) {
ll K;
cin >> K;
cout << fixed << setprecision(10) << table[K] << endl;
}
return 0;
}