import java.util.Date; import java.util.PriorityQueue; import java.util.Scanner; public class Main { static class Tuple implements Comparable{ int level; int count; Tuple(int level,int count){ this.level=level; this.count=count; } public int compareTo(Tuple o){ int value=Integer.compare(level,o.level); if(value==0){ return Integer.compare(count,o.count); } return value; } } static int n=1500; public static void main(String[] args){ Scanner sc=new Scanner(System.in); n=sc.nextInt(); int[] party=new int[n]; int[] enemy=new int[n]; long exec_time=new Date().getTime(); for(int i=0;i queue=new PriorityQueue(n); for(int j=0;j