結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー | kyuridenamida |
提出日時 | 2016-02-19 05:27:18 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 482 ms / 5,000 ms |
コード長 | 765 bytes |
コンパイル時間 | 1,486 ms |
コンパイル使用メモリ | 164,036 KB |
実行使用メモリ | 8,868 KB |
最終ジャッジ日時 | 2023-10-23 18:22:12 |
合計ジャッジ時間 | 12,921 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 481 ms
8,868 KB |
testcase_01 | AC | 481 ms
8,868 KB |
testcase_02 | AC | 482 ms
8,868 KB |
testcase_03 | AC | 474 ms
8,868 KB |
testcase_04 | AC | 481 ms
8,868 KB |
testcase_05 | AC | 478 ms
8,868 KB |
testcase_06 | AC | 465 ms
8,340 KB |
testcase_07 | AC | 477 ms
8,604 KB |
testcase_08 | AC | 478 ms
8,340 KB |
testcase_09 | AC | 469 ms
8,604 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++) #define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++) #define all(n) (n).begin(),(n).end() typedef long long ll; typedef vector<int> Vi; typedef vector<Vi> VVi; typedef pair<long long,long long> Pii; typedef vector<Pii> VPii; double res[500010]; struct NODE{ double x; int y; }; bool operator < (const NODE &a,const NODE &b){ return a.x / a.y < b.x / b.y; } int main(){ priority_queue<NODE> Q; int N; cin >> N; rep(i,N){ int x; cin >> x; Q.push({1.*x,1}); } REP(i,1,500000){ auto q = Q.top(); Q.pop(); res[i] = q.x / q.y; Q.push({q.x,q.y+1}); } int K; cin >> K; rep(i,K){int x; cin >> x;printf("%.10lf\n",res[x]); } }