USACO Gold 2018 February - Snow Boots

Author: Benjamin Qi


Official Analysis (C++)

We can use a sorted set in place of the linked list mentioned in the official solution.

Implementation

Time Complexity: O(NlogN+BlogB)\mathcal{O}(N \log N + B \log B)

C++

We can use a sorted set in place of the linked list mentioned in the official solution.

#include <bits/stdc++.h>
using namespace std;
struct Boot {
int max_depth, max_steps, index;
};
int main() {
freopen("snowboots.in", "r", stdin);

Java

We can use a sorted set in place of the linked list mentioned in the official solution.

import java.io.*;
import java.util.*;
public class SnowBoots {
Code Snippet: Boot Class (Click to expand)
public static void main(String[] args) throws IOException {
Kattio io = new Kattio("snowboots");
int tileNum = io.nextInt();

Python

from typing import NamedTuple
class Boot(NamedTuple):
max_depth: int
max_steps: int
index: int
class Tile:

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!