#include <bits/stdc++.h>
using namespace std;
double dist(double a1, double b1, double a2, double b2) {
return sqrt((a1 - a2)*(a1 - a2) + (b1 - b2)*(b1 - b2));
}
int main()
{
int N;
cin >> N;
double x[N], y[N];
vector <pair <double, pair <int, int> > > v;
set <int> s;
for (int i = 0; i < N; i++) {
cin >> x[i] >> y[i];
for (int j = 0; j < i; j++) {
v.push_back(make_pair(dist(x[i], y[i], x[j], y[j]), make_pair(i, j)));
}
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++) {
s.insert(v[i].second.first);
s.insert(v[i].second.second);
if (s.size() == N) {
printf("%.9f\n", v[i].first / 2);
return 0;
}
}
}
Compilation message
odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for (int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
odasiljaci.cpp:26:22: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
26 | if (s.size() == N) {
| ~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
492 KB |
Output is correct |
6 |
Incorrect |
21 ms |
2528 KB |
Output isn't correct |
7 |
Correct |
21 ms |
2528 KB |
Output is correct |
8 |
Incorrect |
50 ms |
8664 KB |
Output isn't correct |
9 |
Incorrect |
75 ms |
8664 KB |
Output isn't correct |
10 |
Correct |
78 ms |
8664 KB |
Output is correct |