QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#33199#958. Lockout vs touristWu_RenWA 2ms3744kbC++17633b2022-05-29 21:22:462022-05-29 21:22:48

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-05-29 21:22:48]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3744kb
  • [2022-05-29 21:22:46]
  • Submitted

answer

#include <bits/stdc++.h>
typedef long double ld;
using namespace std;
int n,m,c[22];
ld f[4194304],b[22],a[22];
ld calc(){
	ld K=1/(a[0]-b[0]),S=0;
	for(int i=1;i<m;i++){
		if(K*(a[i]-a[i-1])+S>1) return a[i-1]-(1-S)/K;
		S+=K*(a[i]-a[i-1]);
		if(b[i]<a[i]) K+=1/(a[i]-b[i]);
	}
	return a[m-1]-(1-S)/K;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&c[i]);
	sort(c,c+n);
	for(int S=1;S<(1<<n);S++){
		m=0;
		for(int i=n-1;i>=0;i--) if((S>>i)&1){
			b[m]=f[S^(1<<i)],a[m++]=c[i];
			if(b[m-1]>=a[m-1]) f[S]=max(f[S],a[m-1]);
		}
		f[S]=max(f[S],calc());
	}
	printf("%.18Lf",f[(1<<n)-1]);
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3744kb

input:

2
6 7

output:

2.307692307692307692

result:

wrong answer 1st numbers differ - expected: '3.2307692', found: '2.3076923', error = '0.2857143'