Submission #1444614
Source Code Expand
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() #define LL long long using namespace std; long double probability(int rp,int rq){ long double power = pow(10,(rq-rp)/400.0); return 1/(1 + power); } int exclude(int n,int k){ int m=0; int two=1; REP(i,k)two*=2; while(true){ if(m*two<=n&&n<(m+1)*two)break; m++; } return m; } int main(){ int K; cin>>K; int N=1; REP(i,K)N*=2; int R[N]; REP(i,N)cin>>R[i]; long double dp[N][K+1]; fill(dp[0],dp[N],1); REP(j,K){ REP(i,N){ int m=exclude(i,j+1); int n=exclude(i,j); long double sigma=0; int two=1; REP(x,j+1)two*=2; for(int x=m*two;x<(m+1)*two;x++){ if(n*two/2 <=x&&x<(n+1)*two/2)continue; sigma +=probability(R[i],R[x])*dp[x][j]; } dp[i][j+1]=dp[i][j]*sigma; } } REP(i,N)cout<<fixed<<setprecision(10)<<dp[i][K]<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - トーナメント |
User | inmir |
Language | C++14 (GCC 5.4.1) |
Score | 4 |
Code Size | 1130 Byte |
Status | AC |
Exec Time | 83 ms |
Memory | 512 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 4 / 4 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 03, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 83 ms | 512 KB |
01 | AC | 82 ms | 384 KB |
02 | AC | 22 ms | 384 KB |
03 | AC | 82 ms | 384 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |