@@ -0,0 +1,1661 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Apublic class AirConditioned %7B%0A%0A%09public static void main(String%5B%5D args) throws IOException %7B%0A%09%09IO io = new IO(System.in);%0A%0A%09%09int nMinions = io.nextInt();%0A%0A%09%09Minion%5B%5D minions = new Minion%5BnMinions%5D;%0A%09%09for (int i = 0; i %3C nMinions; i++) %7B%0A%09%09%09minions%5Bi%5D = new Minion(io.nextInt(), io.nextInt());%0A%09%09%7D%0A%0A%09%09Arrays.sort(minions, new Comparator%3CMinion%3E() %7B%0A%09%09%09@Override%0A%09%09%09public int compare(Minion m1, Minion m2) %7B%0A%09%09%09%09if (m1.upper %3C m2.upper) %7B%0A%09%09%09%09%09return -1;%0A%09%09%09%09%7D else %7B%0A%09%09%09%09%09return 1;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D);%0A%0A%09%09int rooms = 1;%0A%09%09int threshold = minions%5B0%5D.upper;%0A%09%09for (int i = 1 ; i %3C nMinions; i++) %7B%0A%09%09%09if (minions%5Bi%5D.lower %3E threshold) %7B%0A%09%09%09%09rooms++;%0A%09%09%09%09threshold = minions%5Bi%5D.upper;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09io.println(rooms);%0A%09%09%0A%09%09io.close();%0A%09%7D%0A%0A%09static class Minion %7B%0A%09%09int lower, upper;%0A%0A%09%09Minion(int l, int u) %7B%0A%09%09%09this.lower = l;%0A%09%09%09this.upper = u;%0A%09%09%7D%0A%09%7D%0A%0A%09static class IO extends PrintWriter %7B%0A%09%09static BufferedReader r;%0A%09%09static StringTokenizer t;%0A%0A%09%09public IO(InputStream i) %7B%0A%09%09%09super(new BufferedOutputStream(System.out));%0A%09%09%09r = new BufferedReader(new InputStreamReader(i));%0A%09%09%09t = new StringTokenizer(%22%22);%0A%09%09%7D%0A%0A        public String nextLine() throws IOException %7B%0A            return r.readLine();%0A        %7D%0A%0A%09%09public String next() throws IOException %7B%0A%09%09%09while (!t.hasMoreTokens()) %7B%0A%09%09%09%09t = new StringTokenizer(nextLine());%0A%09%09%09%7D%0A%09%09%09return t.nextToken();%0A%09%09%7D%0A%0A%09%09public int nextInt() throws IOException%7B%0A%09%09%09return Integer.parseInt(next());%0A%09%09%7D%0A%0A%09%09public long nextLong() throws IOException %7B%0A%09%09%09return Long.parseLong(next());%0A%09%09%7D%0A%0A%09%09public double nextDouble() throws IOException %7B%0A%09%09%09return Double.parseDouble(next());%0A%09%09%7D%0A%09%7D%0A%7D%0A

add airconditioned