QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619282#3297. 国王饮水记McIron233100 ✓8ms7932kbC++1414.8kb2024-10-07 13:44:402024-10-07 13:44:41

Judging History

This is the latest submission verdict.

  • [2024-10-07 13:44:41]
  • Judged
  • Verdict: 100
  • Time: 8ms
  • Memory: 7932kb
  • [2024-10-07 13:44:40]
  • Submitted

answer

// This is my answer

#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <iostream>
#define N 8005

// ---------- decimal lib start ----------

const int PREC = 3001;

class Decimal {
	public:
		Decimal();
		Decimal(const std::string &s);
		Decimal(const char *s);
		Decimal(int x);
		Decimal(long long x);
		Decimal(double x);
		
		bool is_zero() const;
		
		// p (p > 0) is the number of digits after the decimal point
		std::string to_string(int p) const;
		double to_double() const;
		
		friend Decimal operator + (const Decimal &a, const Decimal &b);
		friend Decimal operator + (const Decimal &a, int x);
		friend Decimal operator + (int x, const Decimal &a);
		friend Decimal operator + (const Decimal &a, long long x);
		friend Decimal operator + (long long x, const Decimal &a);
		friend Decimal operator + (const Decimal &a, double x);
		friend Decimal operator + (double x, const Decimal &a);
		
		friend Decimal operator - (const Decimal &a, const Decimal &b);
		friend Decimal operator - (const Decimal &a, int x);
		friend Decimal operator - (int x, const Decimal &a);
		friend Decimal operator - (const Decimal &a, long long x);
		friend Decimal operator - (long long x, const Decimal &a);
		friend Decimal operator - (const Decimal &a, double x);
		friend Decimal operator - (double x, const Decimal &a);
		
		friend Decimal operator * (const Decimal &a, int x);
		friend Decimal operator * (int x, const Decimal &a);
		
		friend Decimal operator / (const Decimal &a, int x);
		
		friend bool operator < (const Decimal &a, const Decimal &b);
		friend bool operator > (const Decimal &a, const Decimal &b);
		friend bool operator <= (const Decimal &a, const Decimal &b);
		friend bool operator >= (const Decimal &a, const Decimal &b);
		friend bool operator == (const Decimal &a, const Decimal &b);
		friend bool operator != (const Decimal &a, const Decimal &b);
		
		Decimal & operator += (int x);
		Decimal & operator += (long long x);
		Decimal & operator += (double x);
		Decimal & operator += (const Decimal &b);
		
		Decimal & operator -= (int x);
		Decimal & operator -= (long long x);
		Decimal & operator -= (double x);
		Decimal & operator -= (const Decimal &b);
		
		Decimal & operator *= (int x);
		
		Decimal & operator /= (int x);
		
		friend Decimal operator - (const Decimal &a);
		
		// These can't be called
		friend Decimal operator * (const Decimal &a, double x);
		friend Decimal operator * (double x, const Decimal &a);
		friend Decimal operator / (const Decimal &a, double x);
		Decimal & operator *= (double x);
		Decimal & operator /= (double x);
		
	private:
		static const int len = PREC / 9 + 1;
		static const int mo = 1000000000;
		
		static void append_to_string(std::string &s, long long x);
		
		bool is_neg;
		long long integer;
		int data[len];
		
		void init_zero();
		void init(const char *s);
};

Decimal::Decimal() {
	this->init_zero();
}

Decimal::Decimal(const char *s) {
	this->init(s);
}

Decimal::Decimal(const std::string &s) {
	this->init(s.c_str());
}

Decimal::Decimal(int x) {
	this->init_zero();
	
	if (x < 0) {
		is_neg = true;
		x = -x;
	}
	
	integer = x;
}

Decimal::Decimal(long long x) {
	this->init_zero();
	
	if (x < 0) {
		is_neg = true;
		x = -x;
	}
	
	integer = x;
}

Decimal::Decimal(double x) {
	this->init_zero();
	
	if (x < 0) {
		is_neg = true;
		x = -x;
	}
	
	integer = (long long)x;
	x -= integer;
	
	for (int i = 0; i < len; i++) {
		x *= mo;
		if (x < 0) x = 0;
		data[i] = (int)x;
		x -= data[i];
	}
}

void Decimal::init_zero() {
	is_neg = false;
	integer = 0;
	memset(data, 0, len * sizeof(int));
}

bool Decimal::is_zero() const {
	if (integer) return false;
	for (int i = 0; i < len; i++) {
		if (data[i]) return false;
	}
	return true;
}

void Decimal::init(const char *s) {
	this->init_zero();
	
	is_neg = false;
	integer = 0;
	
	// find the first digit or the negative sign
	while (*s != 0) {
		if (*s == '-') {
			is_neg = true;
			++s;
			break;
		} else if (*s >= 48 && *s <= 57) {
			break;
		}
		++s;
	}
	
	// read the integer part
	while (*s >= 48 && *s <= 57) {
		integer = integer * 10 + *s - 48;
		++s;
	}
	
	// read the decimal part
	if (*s == '.') {
		int pos = 0;
		int x = mo / 10;
		
		++s;
		while (pos < len && *s >= 48 && *s <= 57) {
			data[pos] += (*s - 48) * x;
			++s;
			x /= 10;
			if (x == 0) {
				++pos;
				x = mo / 10;
			}
		}
	}
}

void Decimal::append_to_string(std::string &s, long long x) {
	if (x == 0) {
		s.append(1, 48);
		return;
	}
	
	char _[30];
	int cnt = 0;
	while (x) {
		_[cnt++] = x % 10;
		x /= 10;
	}
	while (cnt--) {
		s.append(1, _[cnt] + 48);
	}
}

std::string Decimal::to_string(int p) const {
	std::string ret;
	
	if (is_neg && !this->is_zero()) {
		ret = "-";
	}
	
	append_to_string(ret, this->integer);
	
	ret.append(1, '.');
	
	for (int i = 0; i < len; i++) {
		// append data[i] as "%09d"
		int x = mo / 10;
		int tmp = data[i];
		while (x) {
			ret.append(1, 48 + tmp / x);
			tmp %= x;
			x /= 10;
			if (--p == 0) {
				break;
			}
		}
		if (p == 0) break;
	}
	
	if (p > 0) {
		ret.append(p, '0');
	}
	
	return ret;
}

double Decimal::to_double() const {
	double ret = integer;
	
	double k = 1.0;
	for (int i = 0; i < len; i++) {
		k /= mo;
		ret += k * data[i];
	}
	
	if (is_neg) {
		ret = -ret;
	}
	
	return ret;
}

bool operator < (const Decimal &a, const Decimal &b) {
	if (a.is_neg != b.is_neg) {
		return a.is_neg && (!a.is_zero() || !b.is_zero());
	} else if (!a.is_neg) {
		// a, b >= 0
		if (a.integer != b.integer) {
			return a.integer < b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] < b.data[i];
			}
		}
		return false;
	} else {
		// a, b <= 0
		if (a.integer != b.integer) {
			return a.integer > b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] > b.data[i];
			}
		}
		return false;
	}
}

bool operator > (const Decimal &a, const Decimal &b) {
	if (a.is_neg != b.is_neg) {
		return !a.is_neg && (!a.is_zero() || !b.is_zero());
	} else if (!a.is_neg) {
		// a, b >= 0
		if (a.integer != b.integer) {
			return a.integer > b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] > b.data[i];
			}
		}
		return false;
	} else {
		// a, b <= 0
		if (a.integer != b.integer) {
			return a.integer < b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] < b.data[i];
			}
		}
		return false;
	}
}

bool operator <= (const Decimal &a, const Decimal &b) {
	if (a.is_neg != b.is_neg) {
		return a.is_neg || (a.is_zero() && b.is_zero());
	} else if (!a.is_neg) {
		// a, b >= 0
		if (a.integer != b.integer) {
			return a.integer < b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] < b.data[i];
			}
		}
		return true;
	} else {
		// a, b <= 0
		if (a.integer != b.integer) {
			return a.integer > b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] > b.data[i];
			}
		}
		return true;
	}
}

bool operator >= (const Decimal &a, const Decimal &b) {
	if (a.is_neg != b.is_neg) {
		return !a.is_neg || (a.is_zero() && b.is_zero());
	} else if (!a.is_neg) {
		// a, b >= 0
		if (a.integer != b.integer) {
			return a.integer > b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] > b.data[i];
			}
		}
		return true;
	} else {
		// a, b <= 0
		if (a.integer != b.integer) {
			return a.integer < b.integer;
		}
		for (int i = 0; i < Decimal::len; i++) {
			if (a.data[i] != b.data[i]) {
				return a.data[i] < b.data[i];
			}
		}
		return true;
	}
}

bool operator == (const Decimal &a, const Decimal &b) {
	if (a.is_zero() && b.is_zero()) return true;
	if (a.is_neg != b.is_neg) return false;
	if (a.integer != b.integer) return false;
	for (int i = 0; i < Decimal::len; i++) {
		if (a.data[i] != b.data[i]) return false;
	}
	return true;
}

bool operator != (const Decimal &a, const Decimal &b) {
	return !(a == b);
}

Decimal & Decimal::operator += (long long x) {
	if (!is_neg) {
		if (integer + x >= 0) {
			integer += x;
		} else {
			bool last = false;
			for (int i = len - 1; i >= 0; i--) {
				if (last || data[i]) {
					data[i] = mo - data[i] - last;
					last = true;
				} else {
					last = false;
				}
			}
			integer = -x - integer - last;
			is_neg = true;
		}
	} else {
		if (integer - x >= 0) {
			integer -= x;
		} else {
			bool last = false;
			for (int i = len - 1; i >= 0; i--) {
				if (last || data[i]) {
					data[i] = mo - data[i] - last;
					last = true;
				} else {
					last = false;
				}
			}
			integer = x - integer - last;
			is_neg = false;
		}
	}
	return *this;
}

Decimal & Decimal::operator += (int x) {
	return *this += (long long)x;
}

Decimal & Decimal::operator -= (int x) {
	return *this += (long long)-x;
}

Decimal & Decimal::operator -= (long long x) {
	return *this += -x;
}

Decimal & Decimal::operator /= (int x) {
	if (x < 0) {
		is_neg ^= 1;
		x = -x;
	}
	
	int last = integer % x;
	integer /= x;
	
	for (int i = 0; i < len; i++) {
		long long tmp = 1LL * last * mo + data[i];
		data[i] = tmp / x;
		last = tmp - 1LL * data[i] * x;
	}
	
	if (is_neg && integer == 0) {
		int i;
		for (i = 0; i < len; i++) {
			if (data[i] != 0) {
				break;
			}
		}
		if (i == len) {
			is_neg = false;
		}
	}
	
	return *this;
}

Decimal & Decimal::operator *= (int x) {
	if (x < 0) {
		is_neg ^= 1;
		x = -x;
	} else if (x == 0) {
		init_zero();
		return *this;
	}
	
	int last = 0;
	for (int i = len - 1; i >= 0; i--) {
		long long tmp = 1LL * data[i] * x + last;
		last = tmp / mo;
		data[i] = tmp - 1LL * last * mo;
	}
	integer = integer * x + last;
	
	return *this;
}

Decimal operator - (const Decimal &a) {
	Decimal ret = a;
	// -0 = 0
	if (!ret.is_neg && ret.integer == 0) {
		int i;
		for (i = 0; i < Decimal::len; i++) {
			if (ret.data[i] != 0) break;
		}
		if (i < Decimal::len) {
			ret.is_neg = true;
		}
	} else {
		ret.is_neg ^= 1;
	}
	return ret;
}

Decimal operator + (const Decimal &a, int x) {
	Decimal ret = a;
	return ret += x;
}

Decimal operator + (int x, const Decimal &a) {
	Decimal ret = a;
	return ret += x;
}

Decimal operator + (const Decimal &a, long long x) {
	Decimal ret = a;
	return ret += x;
}

Decimal operator + (long long x, const Decimal &a) {
	Decimal ret = a;
	return ret += x;
}

Decimal operator - (const Decimal &a, int x) {
	Decimal ret = a;
	return ret -= x;
}

Decimal operator - (int x, const Decimal &a) {
	return -(a - x);
}

Decimal operator - (const Decimal &a, long long x) {
	Decimal ret = a;
	return ret -= x;
}

Decimal operator - (long long x, const Decimal &a) {
	return -(a - x);
}

Decimal operator * (const Decimal &a, int x) {
	Decimal ret = a;
	return ret *= x;
}

Decimal operator * (int x, const Decimal &a) {
	Decimal ret = a;
	return ret *= x;
}

Decimal operator / (const Decimal &a, int x) {
	Decimal ret = a;
	return ret /= x;
}

Decimal operator + (const Decimal &a, const Decimal &b) {
	if (a.is_neg == b.is_neg) {
		Decimal ret = a;
		bool last = false;
		for (int i = Decimal::len - 1; i >= 0; i--) {
			ret.data[i] += b.data[i] + last;
			if (ret.data[i] >= Decimal::mo) {
				ret.data[i] -= Decimal::mo;
				last = true;
			} else {
				last = false;
			}
		}
		ret.integer += b.integer + last;
		return ret;
	} else if (!a.is_neg) {
		// a - |b|
		return a - -b;
	} else {
		// b - |a|
		return b - -a;
	}
}

Decimal operator - (const Decimal &a, const Decimal &b) {
	if (!a.is_neg && !b.is_neg) {
		if (a >= b) {
			Decimal ret = a;
			bool last = false;
			for (int i = Decimal::len - 1; i >= 0; i--) {
				ret.data[i] -= b.data[i] + last;
				if (ret.data[i] < 0) {
					ret.data[i] += Decimal::mo;
					last = true;
				} else {
					last = false;
				}
			}
			ret.integer -= b.integer + last;
			return ret;
		} else {
			Decimal ret = b;
			bool last = false;
			for (int i = Decimal::len - 1; i >= 0; i--) {
				ret.data[i] -= a.data[i] + last;
				if (ret.data[i] < 0) {
					ret.data[i] += Decimal::mo;
					last = true;
				} else {
					last = false;
				}
			}
			ret.integer -= a.integer + last;
			ret.is_neg = true;
			return ret;
		}
	} else if (a.is_neg && b.is_neg) {
		// a - b = (-b) - (-a)
		return -b - -a;
	} else if (a.is_neg) {
		// -|a| - b
		return -(-a + b);
	} else {
		// a - -|b|
		return a + -b;
	}
}

Decimal operator + (const Decimal &a, double x) {
	return a + Decimal(x);
}

Decimal operator + (double x, const Decimal &a) {
	return Decimal(x) + a;
}

Decimal operator - (const Decimal &a, double x) {
	return a - Decimal(x);
}

Decimal operator - (double x, const Decimal &a) {
	return Decimal(x) - a;
}

Decimal & Decimal::operator += (double x) {
	*this = *this + Decimal(x);
	return *this;
}

Decimal & Decimal::operator -= (double x) {
	*this = *this - Decimal(x);
	return *this;
}

Decimal & Decimal::operator += (const Decimal &b) {
	*this = *this + b;
	return *this;
}

Decimal & Decimal::operator -= (const Decimal &b) {
	*this = *this - b;
	return *this;
}

// ---------- decimal lib end ----------
#define double long double
using namespace std;
Decimal ans;
struct node{
	double x,y;
}q[N];
int n,m,k,p,pos,lmt;
int tot=1,h[N],s[N],a[N][25];
double maxx,f[N][25];
int Q[N],hed,til;
double slope(node aa,node bb){
	return (aa.y-bb.y)/(aa.x-bb.x);
}
Decimal calc(int i,int j){
	if(!j)return h[1];
	return (calc(a[i][j],j-1)+s[i]-s[a[i][j]])/(i-a[i][j]+1);
}
signed main(){
	cin>>n>>k>>p>>h[1];
	for(int i=2;i<=n;++i){
		cin>>h[i];
		if(h[i]>h[1])h[++tot]=h[i];
	} n=tot; sort(h+1,h+1+n);
	for(int i=1;i<=n;++i)s[i]=s[i-1]+h[i];
	k=min(k,n);
	for(int i=1;i<=n;++i)f[i][0]=h[1];
	lmt=min(k,14);
	for(int j=1;j<=lmt;++j){
		Q[1]=1; hed=1; til=1;
		for(int i=1;i<=n;++i){
			q[i]=(node){i-1,s[i]-f[i][j-1]};
		}
		for(int i=2;i<=n;++i){
			node cur=(node){i,s[i]};
			while(hed<til && slope(cur,q[Q[hed]])<slope(cur,q[Q[hed+1]]))++hed;
			a[i][j]=Q[hed];
			f[i][j]=(s[i]-s[Q[hed]]+f[Q[hed]][j-1])/(i-Q[hed]+1);
			while(hed<til && slope(q[Q[til]],q[Q[til-1]])>slope(q[Q[til]],q[i]))--til;
			Q[++til]=i;
		}
	} m=n-k+lmt;
	for(int j=0;j<=lmt;++j){
		if(f[m][j]>maxx){
			maxx=f[m][j];
			pos=j;
		}
	}
	ans=calc(m,pos);
	for(int i=m+1;i<=n;++i)ans=(ans+h[i])/2;
	cout<<ans.to_string(p<<1);
	return 0;
}

详细


Pretests


Final Tests

Test #1:

score: 5
Accepted
time: 1ms
memory: 5680kb

input:

2 1 5
276 70074

output:

35175.0000000000

result:

points 1.0 Correct.

Test #2:

score: 5
Accepted
time: 0ms
memory: 5672kb

input:

4 2 5
226 6661 87879 61028

output:

59253.0000000000

result:

points 1.0 Correct.

Test #3:

score: 5
Accepted
time: 0ms
memory: 3636kb

input:

4 5 5
688 61068 87439 35000

output:

63447.5000000000

result:

points 1.0 Correct.

Test #4:

score: 5
Accepted
time: 0ms
memory: 5604kb

input:

10 1 5
916 41527 88488 31815 77742 32612 54686 84884 36513 89880

output:

68382.0000000000

result:

points 1.0 Correct.

Test #5:

score: 5
Accepted
time: 1ms
memory: 5900kb

input:

10 1000000000 5
15 47378 44892 72585 92608 76254 8257 83620 72320 1532

output:

84663.5878906250

result:

points 1.0 Correct.

Test #6:

score: 5
Accepted
time: 0ms
memory: 3864kb

input:

9 2 5
1 5 29 39 44 46 87 88 91

output:

74.8333333333

result:

points 1.0 Correct.

Test #7:

score: 5
Accepted
time: 1ms
memory: 5704kb

input:

10 7 5
858 71725 48085 8186 23583 4490 21271 1143 33780 36720

output:

55724.9843750000

result:

points 1.0 Correct.

Test #8:

score: 5
Accepted
time: 1ms
memory: 5752kb

input:

100 1 5
369 40350 97352 29226 42558 59153 64077 43931 26686 8683 74092 86235 10758 41177 65509 83997 956 33125 10245 75221 58680 30743 61673 89156 88946 14859 19712 43533 90390 59231 66833 46895 65860 97373 51884 76552 61618 94579 75342 27345 88894 85632 27114 15625 33356 58190 13318 14886 5257 3677...

output:

87724.3125000000

result:

points 1.0 Correct.

Test #9:

score: 5
Accepted
time: 1ms
memory: 7748kb

input:

100 1000000000 40
378 53796 72891 87797 44808 68259 42312 98481 44621 13239 57709 27223 99058 2328 52967 35235 1432 64906 94139 70753 88701 23426 72512 21293 89470 6930 55904 46493 25487 94582 73156 49459 3580 80845 21 75925 19594 580 27059 49819 54120 63528 46632 17256 24259 40500 98268 44510 62612...

output:

98272.48518624759254653624321261502894832913568586026201054318615635274625219608424231

result:

points 1.0 Correct.

Test #10:

score: 5
Accepted
time: 0ms
memory: 3564kb

input:

85 3 40
2 7 14 23 56 69 77 78 79 115 116 125 126 138 163 164 174 175 187 193 202 216 222 228 245 251 253 254 256 273 284 289 308 331 332 336 337 339 352 379 380 385 435 439 450 482 495 511 527 559 566 581 599 601 624 679 691 693 731 743 766 771 796 822 839 843 859 870 893 910 919 937 947 951 965 981...

output:

1067.98809523809523809523809523809523809523809523809523809523809523809523809523809523

result:

points 1.0 Correct.

Test #11:

score: 5
Accepted
time: 0ms
memory: 3852kb

input:

93 3 40
1 1775 4094 4320 5474 6016 6183 6432 8564 10556 10570 12363 14420 14688 18863 20859 22403 23800 24550 25836 27077 27552 29185 31452 32274 33446 35220 36840 38779 39222 41616 41751 42465 43059 43063 43066 44076 44473 45058 45293 46893 47503 48612 48986 50916 51486 52795 53041 53558 54511 5481...

output:

88372.42156862745098039215686274509803921568627450980392156862745098039215686274509803

result:

points 1.0 Correct.

Test #12:

score: 5
Accepted
time: 1ms
memory: 3912kb

input:

100 79 40
390 73983 24350 8814 57191 8703 42818 86461 14168 64084 46522 4641 7451 32948 28890 42754 80825 65002 78530 9854 41896 98643 16620 86385 11070 81292 50988 7104 46370 8230 40245 5527 31276 43301 65650 60520 41409 87386 96963 44607 13741 82308 50693 94342 72690 69308 91582 30131 41400 36916 ...

output:

96953.12894399967655248441573506897998766957310253407816465672415991624196370442708333

result:

points 1.0 Correct.

Test #13:

score: 5
Accepted
time: 1ms
memory: 4056kb

input:

250 202 100
466 12726 94995 42181 61551 26194 26295 18957 9565 30219 99075 1344 88601 54835 1031 38483 46390 57214 94355 30166 64058 65820 77846 89028 52081 46428 3550 36554 22414 52578 77796 78445 33182 42468 93635 73164 77982 41806 62569 16858 60126 59441 87804 76051 70504 88836 14158 78890 97112 ...

output:

99523.43347109670512266239087573521334804448809051267562767875849923402015176859705655880637090037348151040936740175390339609146337661380465218724811956082095388634292819506220616353352347181902991400824652

result:

points 1.0 Correct.

Test #14:

score: 5
Accepted
time: 0ms
memory: 3956kb

input:

500 288 200
197 97022 61014 96674 96015 11353 78409 28523 2984 84682 48391 16372 62076 58434 75095 74614 91456 89680 17071 65245 17129 96721 23443 57080 49354 13647 22919 99098 12310 7704 32831 51529 98100 35419 38331 73077 60821 74439 27185 14363 12697 54465 59824 70830 61908 23392 74933 16849 5909...

output:

99563.015675853241410081890952276107476397972940416578833880275685560512931709882683181309203603427518131194036463216057790802946997268444315102441937181949067568832556233111223749993281323361298483188124574632321966596082127881446102714307548730775393563170132844269184196101767676217215401785714285...

result:

points 1.0 Correct.

Test #15:

score: 5
Accepted
time: 1ms
memory: 4004kb

input:

700 199 300
218 89496 23803 67392 25571 28864 29256 82243 10731 80518 10818 54427 30993 122 48615 97618 57421 51500 20359 87690 8657 28151 79289 2731 56280 52730 86159 54766 28814 76535 88455 88440 10148 30757 65593 94013 96739 49644 73813 96751 63746 11975 26083 40824 11091 95875 57064 15963 41153 ...

output:

99903.872911278562595856873829604017592284039215371123097620942311611085988915564496629247299310253555550889237499593071667125445669199096830802127730975688375422199295298556857384634592259923617045084635416666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666...

result:

points 1.0 Correct.

Test #16:

score: 5
Accepted
time: 1ms
memory: 5968kb

input:

700 16 300
672 60468 29689 9977 73129 91578 22070 65047 41333 81310 3576 78591 9788 26867 35990 70395 46845 48772 80460 41292 50604 71401 14 53730 8130 43580 76781 99659 52608 40777 84700 71341 79568 65940 10953 76621 90715 22199 80638 60956 80869 71173 37364 49127 3517 84835 12258 13859 86229 19859...

output:

99762.265742210105613425925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925925...

result:

points 1.0 Correct.

Test #17:

score: 5
Accepted
time: 2ms
memory: 7824kb

input:

700 371 300
113 74738 58329 40420 8396 45487 85270 24334 5764 89603 48388 4471 77540 96260 29787 98110 74190 17925 1658 48927 22023 86165 49061 91931 79891 57898 7096 85627 44643 87018 34207 60970 41121 40109 78008 48832 36645 27277 78984 73185 38224 23692 21163 73385 85283 46426 44906 91109 87128 5...

output:

99645.579718316071912869384663407326422580807270670565353159534100711336493571477114825525318325595630991860275412288707247886292540553963833343920230482017470630112580173856255863670529240222771558760272942154585141958210220319786371486791717397975258856804619282432435116708562591315607564270229688...

result:

points 1.0 Correct.

Test #18:

score: 5
Accepted
time: 4ms
memory: 6704kb

input:

2500 698 1000
471 65145 22981 31527 61463 17912 93154 98762 88954 85282 67970 48145 82925 63997 79972 14039 1947 13344 66726 74770 12070 30529 66514 3159 8464 30655 63943 1259 19551 38488 4914 46199 69583 59938 25646 26771 30352 98906 32061 45542 41565 76542 94290 53440 80683 78109 54067 26455 13617...

output:

99932.970000777785444690932734960670018393401399426765456537753595326887547256825631480382629269773608996392737797266182896783578444846341854602991768174912802779097908765106435371850889854339532735967581072414453566849395317435887155627407657330867244656016089511238395337989912917784737778482885998...

result:

points 1.0 Correct.

Test #19:

score: 5
Accepted
time: 2ms
memory: 6456kb

input:

4000 1080 1500
59 6975 82985 48996 64750 35468 80947 87430 20414 81207 76615 56337 97675 73260 64688 85302 59736 79466 97665 12372 66557 78844 81100 84882 37291 28982 32337 39720 34083 30645 25997 31232 62431 20586 9560 59434 6762 20626 87388 44083 74322 40543 21422 93604 30721 22662 33606 26272 746...

output:

99973.081617528538011087509423590366552409810629087334435102192555672785936741186839836352340105883639662424430096813324177552981811962075368618289345973374437124945851726531687741764019255071062537485972843129134188884300315446473766149852818787326013872368796845026595588543324922659038800438350229...

result:

points 1.0 Correct.

Test #20:

score: 5
Accepted
time: 8ms
memory: 7932kb

input:

8000 1259 3000
734 1497 58191 74822 44289 61274 13696 46410 69145 61280 43170 79691 89523 63252 63602 33131 31768 60692 6809 90757 87813 93136 73358 43535 209 74193 12966 61892 11304 38538 61313 28868 65357 62734 86194 10944 21726 7702 37604 77440 74922 51141 36006 75069 77917 22965 15212 61801 7916...

output:

99982.296883823720574593036727690166897525331363512253875368902166301598745876422485130489307546897416059153086750686259994384370973078420098297053957312944073440223117293583495145467407818394940723409137129596970687172652468457323193509156034864487951940946476301431648943692959509114294075730859710...

result:

points 1.0 Correct.

Extra Test:

score: 0
Extra Test Passed