結果

問題 No.66 輝け☆全国たこやき杯
ユーザー outline
提出日時 2021-02-21 18:32:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,311 bytes
コンパイル時間 1,332 ms
コンパイル使用メモリ 135,652 KB
最終ジャッジ日時 2025-01-19 03:11:15
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;
template<class T>
inline bool chmax(T& x, T y){
if(x < y){
x = y;
return true;
}
return false;
}
template<class T>
inline bool chmin(T& x, T y){
if(x > y){
x = y;
return true;
}
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int M;
cin >> M;
vector<double> S(1 << M);
for(int i = 0; i < 1 << M; ++i) cin >> S[i];
vector<vector<double>> ans(1 << (M + 1), vector<double>(1 << M, 1));
for(int k = M - 1; k >= 0; --k){
for(int i = 0; i < 1 << M; i += 1 << (M - k)){
for(int j = 0; j < 1 << (M - k - 1); ++j){
ans[1 << k][i + j] = 0;
for(int l = 1 << (M - k - 1); l < 1 << (M - k); ++l){
double p = S[i + j] * S[i + j] / (S[i + j] * S[i + j] + S[i + l] * S[i + l]);
ans[1 << k][i + j] += ans[1 << (k + 1)][i + j] * ans[1 << (k + 1)][i + l] * p;
}
}
for(int j = 1 << (M - k - 1); j < 1 << (M - k); ++j){
ans[1 << k][i + j] = 0;
for(int l = 0; l < 1 << (M - k - 1); ++l){
double p = S[i + j] * S[i + j] / (S[i + j] * S[i + j] + S[i + l] * S[i + l]);
ans[1 << k][i + j] += ans[1 << (k + 1)][i + j] * ans[1 << (k + 1)][i + l] * p;
}
}
}
}
for(int state = 1; state < 1 << M; ++state){
for(int player = 0; player < 1 << M; ++player){
cout << ans[state][player] << ' ';
}cout << endl;
}
cout << fixed << setprecision(10);
cout << ans[1][0] << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0