Submission #376252

#TimeUsernameProblemLanguageResultExecution timeMemory
376252tqbfjotldOdašiljači (COCI20_odasiljaci)C++14
70 / 70
128 ms492 KiB
#include <bits/stdc++.h> using namespace std; int p[1005]; int rt(int a){return p[a]==a?a:p[a]=rt(p[a]);} void un(int a, int b){a = rt(a); b = rt(b); p[a] = b;} long long X[1005]; long long Y[1005]; int n; bool check(long long a){ for (int x = 0; x<n; x++){ p[x] = x; } for (int x = 0; x<n; x++){ for (int y = x+1; y<n; y++){ if (((X[x]-X[y])*(X[x]-X[y]))+((Y[x]-Y[y])*(Y[x]-Y[y]))<=a){ un(x,y); } } } int t = rt(0); for (int x = 1; x<n; x++){ if (rt(x)!=t) return false; } return true; } int main(){ scanf("%d",&n); for (int x = 0; x<n; x++){ scanf("%d%d",&X[x],&Y[x]); } long long a = -1; long long b = 2000000000000000000; while (a+1<b){ long long mid = (a+b)/2; if (check(mid)){ b = mid; } else a = mid; } printf("%f",sqrt((double)b)/2); }

Compilation message (stderr)

odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:33:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   33 |         scanf("%d%d",&X[x],&Y[x]);
      |                ~^    ~~~~~
      |                 |    |
      |                 int* long long int*
      |                %lld
odasiljaci.cpp:33:19: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   33 |         scanf("%d%d",&X[x],&Y[x]);
      |                  ~^        ~~~~~
      |                   |        |
      |                   int*     long long int*
      |                  %lld
odasiljaci.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   31 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
odasiljaci.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |         scanf("%d%d",&X[x],&Y[x]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...