USACO Gold 2015 December - High Card Low Card (Gold)

Authors: Qi Wang, Ishwarendra Jha


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

Official Analysis

C++

#include <bits/stdc++.h>
using namespace std;
int number_of_wins(vector<int> &bessie, vector<int> &elsie,
function<bool(int, int)> cmp) {
int n = size(bessie);
assert(size(bessie) == size(elsie));
sort(begin(bessie), end(bessie), cmp);
sort(begin(elsie), end(elsie), cmp);

Java

import java.io.*;
import java.util.*;
public class highcardgold {
static boolean[] C;
static List<Integer> B = new ArrayList<>();
static List<Integer> F = new ArrayList<>();
static List<Integer> S = new ArrayList<>();
static int N;
public static void main(String[] args) throws IOException {

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!