USACO Silver 2016 December - Moocast

Authors: Óscar Garries, Dong Liu

Official Analysis

C++

C++ Implementation

1#include <bits/stdc++.h>
2
3using namespace std;
4
5vector<vector<bool>> isConnected(201, vector<bool>(201));
6vector<int> g[201];
7vector<bool> visited(201);
8int n;
9
10int dfs (int v) {

Python

1import sys
2
3sys.stdin = open("moocast.in", 'r')
4sys.stdout = open("moocast.out", 'w')
5
6def dfs(v):
7 visited[v] = True
8 count = 1
9 for u in range(n):
10 if visited[u] or not canReach[v][u]:

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!

Give Us Feedback on USACO Silver 2016 December - Moocast!