Language: C++

// F.
 
#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>
 
using namespace std;
 
int n, k;
vector<double> x, y, c;
 
struct Point {
	double x;
	double y;
	double dist(const Point& p) {
		double dx = x - p.x, dy = y - p.y;
		return sqrt(dx * dx + dy * dy);
	}
};
 
struct Circle {
	Point p;
	double c;
	double r;
	vector<Point> cross(const Circle& c) {
		vector<Point> pp;
		double dist = p.dist(c.p);
		if (dist <= r + c.r && r <= dist + c.r && r + dist >= c.r) {
			double dx = c.p.x - p.x, dy = c.p.y - p.y;
			double a = (dx * dx + dy * dy + r * r - c.r * c.r) / 2, dd = dx * dx + dy * dy;
			pp.push_back({
				(a * dx + dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy - dx * sqrt(dd * r * r - a * a)) / dd + p.y
			});
			pp.push_back({
				(a * dx - dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy + dx * sqrt(dd * r * r - a * a)) / dd + p.y
			});
		}
		return pp;
	}
};
 
int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		n = -1;
		cin >> n >> k;
		if (n < 0) return 0;
		x.resize(n);
		y.resize(n);
		c.resize(n);
		vector<Circle> cc(n);
		for (int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i] >> c[i];
			cc[i].p.x = x[i];
			cc[i].p.y = y[i];
			cc[i].c = c[i];
		}
		double left = 0, right = 1e9;
		for (int t = 0; t < 100; ++t) {
			double mid = (left + right) / 2;
			for (int i = 0; i < n; ++i) {
				cc[i].r = mid / cc[i].c;
			}
			vector<Point> pp;
			for (int i = 0; i < n; ++i) {
				pp.push_back(cc[i].p);
				for (int j = i + 1; j < n; ++j) {
					for (auto p : cc[i].cross(cc[j])) {
						pp.push_back(p);
					}
				}
			}
			int mc = 0;
			for (auto p : pp) {
				int cnt = 0;
				for (auto c : cc) {
					cnt += p.dist(c.p) <= c.r + 1e-12;
				}
				mc = max(mc, cnt);
			}
			if (mc >= k) {
				right = mid;
			} else {
				left = mid;
			}
		}
		cout << right << endl;
	}
	return 0;
}
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int n, k;
vector<double> x, y, c;

struct Point {
	double x;
	double y;
	double dist(const Point& p) {
		double dx = x - p.x, dy = y - p.y;
		return sqrt(dx * dx + dy * dy);
	}
};

struct Circle {
	Point p;
	double c;
	double r;
	vector<Point> cross(const Circle& c) {
		vector<Point> pp;
		double dist = p.dist(c.p);
		if (dist <= r + c.r && r <= dist + c.r && r + dist >= c.r) {
			double dx = c.p.x - p.x, dy = c.p.y - p.y;
			double a = (dx * dx + dy * dy + r * r - c.r * c.r) / 2, dd = dx * dx + dy * dy;
			pp.push_back({
				(a * dx + dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy - dx * sqrt(dd * r * r - a * a)) / dd + p.y
			});
			pp.push_back({
				(a * dx - dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy + dx * sqrt(dd * r * r - a * a)) / dd + p.y
			});
		}
		return pp;
	}
};

int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		n = -1;
		cin >> n >> k;
		if (n < 0) return 0;
		x.resize(n);
		y.resize(n);
		c.resize(n);
		vector<Circle> cc(n);
		for (int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i] >> c[i];
			cc[i].p.x = x[i];
			cc[i].p.y = y[i];
			cc[i].c = c[i];
		}
		double left = 0, right = 1e9;
		for (int t = 0; t < 100; ++t) {
			double mid = (left + right) / 2;
			for (int i = 0; i < n; ++i) {
				cc[i].r = mid / cc[i].c;
			}
			vector<Point> pp;
			for (int i = 0; i < n; ++i) {
				pp.push_back(cc[i].p);
				for (int j = i + 1; j < n; ++j) {
					for (auto p : cc[i].cross(cc[j])) {
						pp.push_back(p);
					}
				}
			}
			int mc = 0;
			for (auto p : pp) {
				int cnt = 0;
				for (auto c : cc) {
					cnt += p.dist(c.p) <= c.r + 1e-12;
				}
				mc = max(mc, cnt);
			}
			if (mc >= k) {
				right = mid;
			} else {
				left = mid;
			}
		}
		cout << right << endl;
	}
	return 0;
}
Submission Info
Submission Time

Compiler output:
a.cc:108:5: error: redefinition of 'int n'
  108 | int n, k;
      |     ^
a.cc:11:5: note: 'int n' previously declared here
   11 | int n, k;
      |     ^
a.cc:108:8: error: redefinition of 'int k'
  108 | int n, k;
      |        ^
a.cc:11:8: note: 'int k' previously declared here
   11 | int n, k;
      |        ^
a.cc:109:16: error: redefinition of 'std::vector<double> x'
  109 | vector<double> x, y, c;
      |                ^
a.cc:12:16: note: 'std::vector<double> x' previously declared here
   12 | vector<double> x, y, c;
      |                ^
a.cc:109:19: error: redefinition of 'std::vector<double> y'
  109 | vector<double> x, y, c;
      |                   ^
a.cc:12:19: note: 'std::vector<double> y' previously declared here
   12 | vector<double> x, y, c;
      |                   ^
a.cc:109:22: error: redefinition of 'std::vector<double> c'
  109 | vector<double> x, y, c;
      |                      ^
a.cc:12:22: note: 'std::vector<double> c' previously declared here
   12 | vector<double> x, y, c;
      |                      ^
a.cc:111:8: error: redefinition of 'struct Point'
  111 | struct Point {
      |        ^~~~~
a.cc:14:8: note: previous definition of 'struct Point'
   14 | struct Point {
      |        ^~~~~
a.cc:120:8: error: redefinition of 'struct Circle'
  120 | struct Circle {
      |        ^~~~~~
a.cc:23:8: note: previous definition of 'struct Circle'
   23 | struct Circle {
      |        ^~~~~~
a.cc:143:5: error: redefinition of 'int main(int, char**)'
  143 | int main(int argc, char* argv[]) {
      |     ^~~~
a.cc:46:5: note: 'int main(int, char**)' previously defined here
   46 | int main(int argc, char* argv[]) {
      |     ^~~~
a.cc:195:1: error: 'Submission' does not name a type
  195 | Submission Info
      | ^~~~~~~~~~