Submission #701144

#TimeUsernameProblemLanguageResultExecution timeMemory
701144Chal1shkanOdašiljači (COCI20_odasiljaci)C++14
Compilation error
0 ms0 KiB
#include <algorithm> #include <iostream> #include <iomanip> #include <bitset> #include <cmath> #include <set> #include <unordered_map> #include <numeric> # define pb push_back # define ff first # define ss second # define nl "\n" # define sz(x) ((int)(x).size()) # define deb(x) cerr << #x << " = " << x << endl; typedef long long ll; typedef unsigned long long ull; typedef double ld; const ll maxn = 1e3 + 25; const ll inf = 3e9 + 0; const ll mod = 1e9 + 7; const ll dx[] = {-1, 1, 0, 0}; const ll dy[] = {0, 0, -1, 1}; const ld eps = 1e-6; using namespace std; int n; pair <ld, ld> p[maxn]; struct DSU { int par[maxn]; DSU () { iota(par, par + maxn, 0); } int find_set (int v) { if (v == par[v]) return v; return v = find_set(par[v]); } bool union_sets (int u, int v) { u = find_set(u); v = find_set(v); if (u == v) return 0; par[v] = u; return 1; } } zxc; ld dist (pair <ld, ld> q, pair <ld, ld> w) { return (ld)sqrt((q.ff - w.ff) * (q.ff - w.ff) + (q.ss - w.ss) * (q.ss - w.ss)); } bool cmp (pair <int, int> x, pair <int, int> y) { return dist(p[x.ff], p[x.ss]) < dist(p[y.ff], p[y.ss]); } void ma1n (/* SABR */) { cin >> n; for (int i = 1; i <= n; ++i) { cin >> p[i].ff >> p[i].ss; } vector <pair <int, int> > g; for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++j) { g.pb({i, j}); } } sort(g.begin(), g.end(), cmp); ld ans = 0; for (int i = 0; i < sz(g); ++i) { if (zxc.union_sets(g[i].ff, g[i].ss)) { ans = dist(p[g[i].ff], p[g[i].ss]); } } cout << fixed << setprecision(8) << ans / 2 - eps; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("file.in", "r", stdin); // freopen("file.out", "w", stdout); int ttt = 1; // cin >> ttt; for (int test = 1; test <= ttt; ++test) { // cout << "Case " << test << ":" << ' '; ma1n(); } return 0; }

Compilation message (stderr)

odasiljaci.cpp: In function 'void ma1n()':
odasiljaci.cpp:71:5: error: 'vector' was not declared in this scope
   71 |     vector <pair <int, int> > g;
      |     ^~~~~~
odasiljaci.cpp:9:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    8 | #include <numeric>
  +++ |+#include <vector>
    9 | 
odasiljaci.cpp:71:29: error: expected primary-expression before '>' token
   71 |     vector <pair <int, int> > g;
      |                             ^
odasiljaci.cpp:71:31: error: 'g' was not declared in this scope
   71 |     vector <pair <int, int> > g;
      |                               ^