結果
| 問題 |
No.66 輝け☆全国たこやき杯
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-17 07:52:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 1,566 bytes |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 96,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 14:50:38 |
| 合計ジャッジ時間 | 1,315 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
int main()
{
int m;
cin >> m;
int n = 1 << m;
vector<vector<pair<double, double> > > s(n, vector<pair<double, double> >(1));
for(int i=0; i<n; ++i){
cin >> s[i][0].first;
s[i][0].first *= s[i][0].first;
s[i][0].second = 1.0;
}
for(int i=0; i<m; ++i){
vector<vector<pair<double, double> > > s2(n/(2<<i), vector<pair<double, double> >(2<<i));
for(int j=0; j<n/(2<<i); ++j){
for(int a=0; a<(1<<i); ++a){
s2[j][a].first = s[j*2][a].first;
s2[j][(1<<i)+a].first = s[j*2+1][a].first;
}
for(int a=0; a<(1<<i); ++a){
for(int b=0; b<(1<<i); ++b){
double sa = s[j*2][a].first;
double sb = s[j*2+1][b].first;
double pa = s[j*2][a].second;
double pb = s[j*2+1][b].second;
s2[j][a].second += pa * pb * sa / (sa + sb);
s2[j][(1<<i)+b].second += pa * pb * sb / (sa + sb);
}
}
}
s.swap(s2);
}
printf("%.10f\n", s[0][0].second);
return 0;
}