제출 #1270891

#제출 시각아이디문제언어결과실행 시간메모리
1270891SmuggingSpunOdašiljači (COCI20_odasiljaci)C++20
70 / 70
84 ms328 KiB
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
typedef long long ll;
ll square(int x){
	return 1LL * x * x;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	int n;
	cin >> n;
	vector<int>x(n), y(n);
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
	}
	ll low = 0, high = 8e18, ans;
	while(low <= high){
		ll mid = low + ((high - low) >> 1LL);
		int cnt = 0;
		queue<int>q;
		vector<bool>vis(n, false);
		q.push(1);
		vis[1] = true;
		while(!q.empty()){
			int i = q.front();
			q.pop();
			cnt++;
			for(int j = 0; j < n; j++){
				if(!vis[j] && square(x[i] - x[j]) + square(y[i] - y[j]) <= mid){
					vis[j] = true;
					q.push(j);
				}
			}
		}
		if(cnt == n){
			high = (ans = mid) - 1;
		}
		else{
			low = mid + 1;
		}
	}
	cout << setprecision(9) << fixed << sqrtl(double(ans) / 4.0);
}

컴파일 시 표준 에러 (stderr) 메시지

odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:11:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...