USACO Silver 2017 January - Cow Dance Show
Authors: Óscar Garries, Juheon Rhee, Brad Ma
C++
Time Complexity:
#include <bits/stdc++.h>using namespace std;int main() {freopen("cowdance.in", "r", stdin);freopen("cowdance.out", "w", stdout);int n, t;cin >> n >> t;int ar[n];
Python
import heapqwith open("cowdance.in") as r:n, maximum = map(int, r.readline().split())dance = [int(r.readline()) for _ in range(n)]left = 1right = n + 1while left < right:mid = (left + right) // 2
Java
import java.io.*;import java.util.*;public class CowDanceShow {static int[] danceTimes;static int n;static int maxTime;static boolean isOk(int stageSize) {PriorityQueue<Integer> currentDancing = new PriorityQueue<>();
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!