USACO Gold 2018 February - Snow Boots

Author: Benjamin Qi

Official Analysis

We can use an ordered set in place of the linked list mentioned in the official solution. The time complexity remains the same.

#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("snowboots.in","r",stdin);
freopen("snowboots.out","w",stdout);
int N,B; cin >> N >> B;
vector<int> f(N); for (int& t: f) cin >> t;

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!