import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Dominating Duos. * * @author vanb */ public class dominating_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; /** * A Person. * * @author vanb */ private class Person implements Comparable { /** Their height. */ public int height; /** Where they stand. */ public int index; /** * Instantiates a new person. * * @param height their height * @param index where they stand */ public Person(int height, int index) { this.height = height; this.index = index; } /** * Compare two people by height, bigger first. * * @param other the other Person * @return Standard for compareTo */ @Override public int compareTo( Person other ) { return other.height - this.height; } /** * To string for debugging. * * @return the string */ @Override public String toString() { return "[" + height + " at " + index + "]"; } } /** * Do it!. */ private void doit() { // Read in the people, remember their height and where they stand int n = sc.nextInt(); Person people[] = new Person[n]; for( int i=0; imax ) max = people[i].index; else if( people[i].index