USACO Gold 2016 December - Moocast
Authors: Neo Wang, Óscar Garries
C++
Implementation (DSU)
#include <bits/stdc++.h>using namespace std;#define vt vector#define FOR(i, a, b) for(int i = (a); i < (b); i++)#define FORE(i, a, b) for(int i = (a); i <= (b); i++)#define F0R(i, a) for(int i = 0; i < (a); i++)#define trav(a, x) for (auto& a : x)
Implementation (Binary Search + DFS)
#include <bits/stdc++.h>using namespace std;using ll = long long;const int maxN = 1e3;vector<int> x(maxN), y(maxN);vector<bool> visited(maxN);vector<vector<bool>> g(maxN, vector<bool>(maxN, false));
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!