# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
854452 | vjudge1 | Odašiljači (COCI20_odasiljaci) | C++17 | 59 ms | 14276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
#define lim 200005
using namespace std;
int dad[1005];
int find(int x){
if(dad[x]==x) return x;
return dad[x] = find(dad[x]);
}
void unite(int x, int y){
dad[find(x)] = find(y);
}
void solve(){
int n; cin >> n;
for(int i=1; i<=n; i++){
dad[i]=i;
}
ii arr[n+1];
for(int i=1; i<=n; i++) cin >> arr[i].st >> arr[i].nd;
vector<tuple<double, int, int>> wow;
for(int i=1; i<=n; i++){
for(int j=i+1; j<=n; j++){
int sq1, sq2;
sq1 = (arr[i].st-arr[j].st)*(arr[i].st-arr[j].st);
sq2 = (arr[i].nd-arr[j].nd)*(arr[i].nd-arr[j].nd);
wow.pb({sqrt(((double)sq1 + (double)sq2))/(double)2, i, j});
//cerr << sqrt((double)sq1 + (double)sq2) / ((double)2) << endl;
}
}
sort(all(wow));
double ans;
for(auto t:wow){
//cerr << get<0>(t) << endl;
int a=get<1>(t),b=get<2>(t);
if(find(a)==find(b)) continue;
unite(a,b);
ans = get<0>(t);
}
cout << setprecision(15) << ans << endl;
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
//cin >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |