Rating changes for the last round are temporarily rolled back. They will be returned soon. ×

 
 
 
 
General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
86349632 Practice:
JKLover
839E - 62 GNU C++17 Accepted 218 ms 3656 KB 2020-07-09 15:47:43 2020-07-09 15:47:43
 
 
→ Source
//%std
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out = 0, fh = 1;
	char jp = getchar();
	while ((jp > '9' || jp < '0') && jp != '-')
		jp = getchar();
	if (jp == '-')
		fh = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * fh;
}
void print(int x)
{
	if (x >= 10)
		print(x / 10);
	putchar('0' + x % 10);
}
void write(int x, char c)
{
	if (x < 0)
		putchar('-'), x = -x;
	print(x);
	putchar(c);
}
const int N = 40 + 10;
int n, m = 0, G[N][N], p[N], in[N];
double k;
void solve()
{
	for (int i = 1; i <= n; ++i)
		in[i] = 0;
	int s = 0;
	for (int i = 1; i <= n; ++i)
	{
		int f = 1;
		for (int j = 1; j < i && f; ++j)
			if (in[j] && !G[p[i]][p[j]])
				f = 0;
		if (f)
			++s, in[i] = 1;
	}
	m = max(m, s);	
}
int main()
{
	n = read(), k = (double)(read());
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
			G[i][j] = read();
	iota(p + 1, p + n + 1, 1);
	srand(time(0));
	for (int i = 1; i <= 100000; ++i)
	{
		random_shuffle(p + 1, p + 1 + n);
		solve();
	}
	double ans = (k / m) * (k / m) * m * (m - 1) / 2;
	printf("%.7f\n", ans);
	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details