結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー | Shibuyap |
提出日時 | 2020-10-24 18:02:02 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 490 ms / 5,000 ms |
コード長 | 964 bytes |
コンパイル時間 | 3,990 ms |
コンパイル使用メモリ | 203,652 KB |
実行使用メモリ | 12,064 KB |
最終ジャッジ日時 | 2023-09-28 20:33:16 |
合計ジャッジ時間 | 15,774 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 490 ms
12,064 KB |
testcase_01 | AC | 469 ms
11,600 KB |
testcase_02 | AC | 475 ms
11,372 KB |
testcase_03 | AC | 465 ms
11,652 KB |
testcase_04 | AC | 469 ms
11,656 KB |
testcase_05 | AC | 470 ms
11,620 KB |
testcase_06 | AC | 454 ms
10,880 KB |
testcase_07 | AC | 462 ms
11,124 KB |
testcase_08 | AC | 458 ms
10,592 KB |
testcase_09 | AC | 463 ms
10,940 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); ++i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair<double, int> P; #define yn {puts("Yes");}else{puts("No");} #define MAX_N 200005 double f[600000] = {}; int main() { int n; cin >> n; double a[n]; rep(i,n) cin >> a[i]; int q; cin >> q; int b[q]; rep(i,q) cin >> b[i]; pair<P,int> p; priority_queue<pair<P,int>> que; rep(i,n){ p.first.first = a[i]; p.first.second = 1; p.second = i; que.push(p); } srep(i,1,600000){ p = que.top(); que.pop(); f[i] = p.first.first; p.first.second++; p.first.first = a[p.second] / p.first.second; que.push(p); } rep(i,q){ cout << fixed << setprecision(10) << f[b[i]] << endl; } return 0; }