답안 #346558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
346558 2021-01-10T08:20:52 Z Nursik Odašiljači (COCI20_odasiljaci) C++14
28 / 70
874 ms 628 KB
#include <bits/stdc++.h>
 
#define f first
#define s second
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end() 
#define ld long double
#define fi first
#define se second
 
using namespace std; 
 
void data() {
	#ifdef NURS
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif	
} 
void win()
{	
	ios_base::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
}
 
int block = 400;
const ld eps = 1e-7; 
 
const int N = 1e6 + 500;
const int mod = 1e9 + 7;
 
const ll hh = 100010683;
const ll hh2 = 150005819;
 
int n, vis; ld x[2000], y[2000]; bool was[2000];
void dfs(int v, ld r)
{
	if (was[v])
		return;
	vis++;
	was[v] = 1;
	for (int i = 1; i <= n; i++)
	{
		if (i != v && sqrt((x[i] - x[v]) * (x[i] - x[v]) + (y[i] - y[v]) * (y[i] - y[v])) <= r + r)
		{
			dfs(i, r);
		}
	}
}
bool check(ld xe)
{
	vis = 0;
	dfs(1, xe);
	return (vis == n);	
}
main()
{
	data();              
	win();        	
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e12, ans;
	for (int i = 1; i <= 50; i++)
	{
		ld mid = (l + r) / 2.0;
		if (check(mid))
		{
			r = mid - eps;
			ans = mid;
		}
		else
		{
			l = mid + eps;
		}
		for (int i = 1; i <= n; i++)
		{
			was[i] = 0;
		}
	}
	cout << fixed << setprecision(9) << ans;
}
/*
Если я солью, то я обязательно затащю
*/

Compilation message

odasiljaci.cpp:56:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   56 | main()
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 3 ms 364 KB Output isn't correct
4 Correct 6 ms 364 KB Output is correct
5 Correct 9 ms 364 KB Output is correct
6 Incorrect 245 ms 384 KB Output isn't correct
7 Incorrect 260 ms 468 KB Output isn't correct
8 Incorrect 571 ms 504 KB Output isn't correct
9 Correct 874 ms 628 KB Output is correct
10 Correct 780 ms 540 KB Output is correct