QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#323391 | #2913. Archery Accuracy | chmpro | WA | 279ms | 5424kb | C++20 | 1007b | 2024-02-09 14:27:05 | 2024-02-09 14:27:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define vi vector<int>
#define vvi vector<vector<int>>
#define rep(i, st, ed) for(int i = st; i < ed; ++i)
#ifndef ONLINE_JUDGE
#include "myprettyprint.hpp"
#else
#define dbg(...)
#endif
int N;
vector<ld> P,DP;
vi S;
ld rw(int k,int n,ld p){
ld q=1.0L-p;
ld r=q/p;
if(abs(p-q)<1e-9) return k/n;
else return (1-pow(r,k))/(1-pow(r,n));
}
void solve(){
cin>>N;
P.resize(N); S.resize(N+1);
rep(i,0,N) cin>>P[i];
rep(i,0,N) cin>>S[i+1];
DP.resize(1<<N,0.0L);
DP[0]=1.0L;
rep(bit,1,1<<N){
int n=__builtin_popcount(bit);
rep(i,0,N) if(bit&(1<<i)){
DP[bit]=max(DP[bit],DP[bit^(1<<i)]*rw(S[n-1]+S[n],S[n]*2,P[i]) + \
(1-DP[bit^(1<<i)])*rw(-S[n-1]+S[n],S[n]*2,P[i]));
}
}
cout<<fixed;
cout.precision(15);
cout << DP[(1<<N)-1] << '\n';
dbg(DP);
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 279ms
memory: 5424kb
input:
17 0.49 0.45 0.50 0.47 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.49 0.50 0.49 0.50 0.49 15 16 17 18 19 20 26 29 86 88 89 93 95 96 97 98 100
output:
0.000130058918337
result:
wrong answer 1st numbers differ - expected: '0.4516422', found: '0.0001301', error = '0.4515122'