USACO Silver 2017 December - Milk Measurement

Authors: Qi Wang, Kevin Sheng


Official Analysis (C++)

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

C++

#include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <vector>
using std::cout;
using std::endl;
using std::vector;

Java

import java.io.*;
import java.util.*;
public class Measurement {
Code Snippet: Log Class (Click to expand)
public static void main(String[] args) throws IOException {
Kattio io = new Kattio("measurement");
int n = io.nextInt();
int g = io.nextInt();

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!