QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323391#2913. Archery AccuracychmproWA 279ms5424kbC++201007b2024-02-09 14:27:052024-02-09 14:27:05

Judging History

你现在查看的是最新测评结果

  • [2024-02-09 14:27:05]
  • 评测
  • 测评结果:WA
  • 用时:279ms
  • 内存:5424kb
  • [2024-02-09 14:27:05]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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'