結果
| 問題 |
No.68 よくある棒を切る問題 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-05 00:54:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 279 ms / 5,000 ms |
| コード長 | 1,010 bytes |
| コンパイル時間 | 1,443 ms |
| コンパイル使用メモリ | 171,840 KB |
| 実行使用メモリ | 9,876 KB |
| 最終ジャッジ日時 | 2024-09-13 12:34:37 |
| 合計ジャッジ時間 | 12,776 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | rep (i, N) scanf("%lld", &L[i]);
| ~~~~~^~~~~~~~~~~~~~~
main.cpp:34:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
34 | scanf("%d", &K);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define GET_MACRO(a, b, c, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define rep2(i, a) rep3 (i, 0, a)
#define rep3(i, a, b) for (int i = (a); i < (b); i++)
#define repr(...) GET_MACRO(__VA_ARGS__, repr3, repr2)(__VA_ARGS__)
#define repr2(i, a) repr3 (i, 0, a)
#define repr3(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define chmin(a, b) ((b) < a && (a = (b), true))
#define chmax(a, b) (a < (b) && (a = (b), true))
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<ll> L(N);
rep (i, N) scanf("%lld", &L[i]);
typedef tuple<double, int, int> P; // len, div, id
priority_queue<P> q;
rep (i, N) q.emplace(L[i], 1, i);
vector<double> ans(505050);
rep (i, 505050) {
double len;
int d, id;
tie(len, d, id) = q.top(); q.pop();
ans[i] = len;
q.emplace((double)L[id] / (d + 1), d + 1, id);
}
int Q;
cin >> Q;
rep (i, Q) {
int K;
scanf("%d", &K);
printf("%.20f\n", ans[K - 1]);
}
return 0;
}