QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#35179#958. Lockout vs touristFroggyguaWA 3ms3912kbC++17571b2022-06-14 14:41:132022-06-14 14:41:14

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-14 14:41:14]
  • Judged
  • Verdict: WA
  • Time: 3ms
  • Memory: 3912kb
  • [2022-06-14 14:41:13]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define N 22
typedef long long ll;
const double eps=1e-9;
int n;
double dp[1<<N],a[N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.setf(ios::fixed);
	cout.precision(10);
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	for(int s=1;s<(1<<n);++s){
		double k=0,b=-1;
		double mx=0;
		for(int i=0;i<n;++i){
			if(s>>i&1){
				double t=dp[s^(1<<i)];
				if(t>=a[i])continue;
				k+=1.0/(a[i]-t);
				b+=a[i]/(a[i]-t);
			}
		}
		dp[s]=b/k;
	}
	cout<<dp[(1<<n)-1]<<'\n';
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 3836kb

input:

2
6 7

output:

3.2307692308

result:

ok found '3.2307692', expected '3.2307692', error '0.0000000'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3756kb

input:

3
1 1 1

output:

0.8333333333

result:

ok found '0.8333333', expected '0.8333333', error '0.0000000'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3912kb

input:

11
1 2 3 4 5 6 7 8 9 10 11

output:

9.4422713866

result:

ok found '9.4422714', expected '9.4422714', error '0.0000000'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

2
1 1000000000

output:

0.9999999990

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 2ms
memory: 3752kb

input:

5
76 57 68 36 63

output:

62.8161435690

result:

wrong answer 1st numbers differ - expected: '63.3539651', found: '62.8161436', error = '0.0084892'