結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー |
|
提出日時 | 2021-01-10 07:02:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 484 ms / 5,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 943 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 10,336 KB |
最終ジャッジ日時 | 2024-11-20 10:44:57 |
合計ジャッジ時間 | 12,958 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream>#include<iomanip>#include<queue>using namespace std;int N;double ans[5<<17];main(){cin>>N;priority_queue<pair<double,pair<int,int> > >P;for(int i=0;i<N;i++){int L;cin>>L;P.push(make_pair(L,make_pair(L,1)));}for(int i=1;i<5<<17;i++){ans[i]=P.top().first;pair<int,int>p=P.top().second;P.pop();p.second++;P.push(make_pair((double)p.first/p.second,p));}int Q;cin>>Q;for(;Q--;){int k;cin>>k;cout<<fixed<<setprecision(16)<<ans[k]<<endl;}}