list2.add(p);
Collections.sort(list2);
} else {
list3.add(p);
Collections.sort(list3);
}
} else {//out
int docid = sc.nextInt();
if (docid == 1) {
if (list1.isEmpty())
System.out.println("EMPTY");
else
System.out.println(list1.poll().id);
} else if (docid == 2) {
if (list2.isEmpty())
System.out.println("EMPTY");
else
System.out.println(list2.poll().id);
} else {
if (list3.isEmpty())
System.out.println("EMPTY");
else
System.out.println(list3.poll().id);
}
}
}
}
}
}
class Patient implements Comparable
public int docId;
public int priority;
public int id;
public Patient(int id, int docId, int priority) {
this.id = id;
this.docId = docId;
this.priority = priority;
}
@Override
public int compareTo(Patient o) {
if (this.priority >= o.priority)
return -1;
return 1;
}
}
作者:lhfight