For this Question: There are N types of virus also each virus has an affinity equal to A[i]. You want to find the top 10 virus with the highest affinity.

Expected Time Complexity: O(N)First line contains an integer N.
Next line contains N space separated integers denoting elements of array.

Constraints
10 <= N <= 10^7
1 <= Ai <= 10^5Print the affinity of top 10 virus in sorted order.Sample Input 1:
10
1 2 3 4 5 6 7 8 9 10

Output 
1 2 3 4 5 6 7 8 9 10

Sample Input 2:
15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Output 
6 7 8 9 10 11 12 13 14 15
, I have written this Solution Code: /*package whatever //do not write package name here */

import java.io.*;
import java.util.*;

class Main{
	public static void main (String[] args) {
	    try{
	        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	    int n=Integer.parseInt(br.readLine());
    	    int a[] = new int[n];
            String line = br.readLine(); // to read multiple integers line
            String[] strs = line.trim().split("\\s+");
            for (int i = 0; i < n; i++) {
                 a[i] = Integer.parseInt(strs[i]);
            }
            PriorityQueue<Integer> q = new PriorityQueue<Integer>();
    	    for(int i=0;i<n;i++){
                q.add(a[i]);
                if (q.size() > 10) {
    			    q.poll();
    		    }
            }  
            while (q.size()>0) {
    		    System.out.print(q.peek());
    		    System.out.print(" ");
    		    q.poll();
    	    }
	    }
	    catch(Exception e){
	        
	    }
	    
	     
	}
	
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?