You are viewing a single comment's thread. Return to all comments →
in java i used a TreeSet
public static void main(String[] args) { Scanner s = new Scanner(System.in);
int q = s.nextInt(); Set<Integer> heap = new TreeSet<>(); for (int i = 0; i<q;i++) { int qt = s.nextInt(); switch (qt) { case 1: heap.add(s.nextInt()); break; case 2: heap.remove(s.nextInt()); break; case 3: System.out.println( heap.stream().findFirst().get() ); break; } } s.close(); } } s.close(); }
Seems like cookies are disabled on this browser, please enable them to open this website
QHEAP1
You are viewing a single comment's thread. Return to all comments →
in java i used a TreeSet
public static void main(String[] args) { Scanner s = new Scanner(System.in);