USACO Silver 2017 US Open - Where's Bessie?

Authors: Qi Wang, Pranav Jadhav


Official Analysis (C++)

Implementation

Time Complexity: O(N6+PCLs2)\mathcal{O}(N^6+|PCLs|^2)

C++

#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 20;
vector<vector<char>> image(MAX_N, vector<char>(MAX_N));
vector<vector<bool>> visited(MAX_N, vector<bool>(MAX_N));
/** PCL delimited by the top left corner (i1, j1) & bottom right corner (i2, j2)
*/
struct PCL {

Java

import java.io.*;
import java.util.*;
public class Where {
static final int MAX_N = 20;
static char[][] image = new char[MAX_N][MAX_N];
static boolean[][] visited = new boolean[MAX_N][MAX_N];
static int iMin, iMax, jMin, jMax;

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!