Submission #1270890

#TimeUsernameProblemLanguageResultExecution timeMemory
1270890SmuggingSpunOdašiljači (COCI20_odasiljaci)C++20
35 / 70
76 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 = 2e18, ans; while(low <= high){ ll mid = (low + high) >> 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 << 2LL)){ vis[j] = true; q.push(j); } } } if(cnt == n){ high = (ans = mid) - 1; } else{ low = mid + 1; } } cout << setprecision(9) << fixed << sqrtl(ans); }

Compilation message (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...