結果
問題 | No.68 よくある棒を切る問題 (2) |
ユーザー | atetubou |
提出日時 | 2014-11-16 23:40:12 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 423 ms / 5,000 ms |
コード長 | 1,585 bytes |
コンパイル時間 | 1,712 ms |
コンパイル使用メモリ | 168,864 KB |
実行使用メモリ | 10,876 KB |
最終ジャッジ日時 | 2024-12-31 22:16:18 |
合計ジャッジ時間 | 13,710 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef ll li; typedef pair<ll,ll> PI; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define REP(i, n) rep (i, n) #define F first #define S second #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define SZ(a) (int)((a).size()) #define ALL(a) (a).begin(),(a).end() #define FLL(a,b) memset((a),b,sizeof(a)) #define CLR(a) memset((a),0,sizeof(a)) #define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it) #define FORR(it,a) for(__typeof(a.rbegin())it=a.rbegin();it!=a.rend();++it) template<typename T,typename U> ostream& operator<< (ostream& out, const pair<T,U>& val){return out << "(" << val.F << ", " << val.S << ")";} template<class T> ostream& operator<< (ostream& out, const vector<T>& val){out << "{";rep(i,SZ(val)) out << (i?", ":"") << val[i];return out << "}";} #define declare(a,it) __typeof(a) it=a const double EPS = 1e-8; const int dx[]={1,0,-1,0,1,1,-1,-1,0}; const int dy[]={0,1,0,-1,-1,1,-1,1,0}; int main(int argc, char *argv[]) { int n; cin >> n; vector<int> l(n); rep(i,n) cin >> l[i]; priority_queue<pair<double,int> > q; rep(i,n) q.push(mp(l[i],1)); vector<double> ans; while(SZ(ans)<=5e5+10){ double cc = q.top().F; int cv = q.top().S; q.pop(); ans.pb(cc); q.push(mp(cc*cv/(cv+1),cv+1)); } { int q; cin >> q; rep(i,q){ int k; cin >> k; printf("%.18f\n",ans[k-1]); //cout << ans[k-1] << endl; } } }