Official Analysis

Video Solution

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

Implementation

C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x_coordinates(n);
vector<int> y_coordinates(n);
vector<int> east_cows;

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));
int n = Integer.parseInt(br.readLine());

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!