USACO Silver 2020 December - Stuck in a Rut

Authors: Qi Wang, Melody Yu (Video), Brad Ma

Official Analysis

Video Solution

Note: The video solution might not be the same as other solutions. Code in C++.

Implementation

C++

// Created by Qi Wang
#include <bits/stdc++.h>
using namespace std;
#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)

Java

import java.io.*;
import java.util.*;
public class StuckInARut {
static int[] xCoordinates;
static int[] yCoordinates;
public static void main(String[] args) throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));

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!