fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8.  
  9. class WhoAmI {
  10. public int whatAmIDoing(int x) {
  11. set.add(x);
  12. return set.headSet(x).size();
  13. }
  14.  
  15. public static long howDoIProcessThisArray(int[] a) {
  16. WhoAmI obj = new WhoAmI();
  17. long res = 0;
  18. for (int i = 0; i < a.length; ++i) {
  19. res += obj.whatAmIDoing(a[i]);
  20. }
  21. return res;
  22. }
  23.  
  24. private SortedSet<Integer> set = new TreeSet<Integer>();
  25. System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
  26. }
  27.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                     ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                   ^
Main.java:25: error: ';' expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                    ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                             ^
Main.java:25: error: illegal start of type
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                              ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                               ^
Main.java:25: error: ';' expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                ^
Main.java:25: error: illegal start of type
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                  ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                   ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                      ^
Main.java:25: error: illegal start of type
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                        ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                         ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                            ^
Main.java:25: error: illegal start of type
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                              ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                               ^
Main.java:25: error: ';' expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                                 ^
Main.java:25: error: illegal start of type
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                                  ^
Main.java:25: error: <identifier> expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                                   ^
Main.java:25: error: ';' expected
   System.out.println(WhoAmI.howDoIProcessThisArray(new int[]{2, 4, 7, 2, 5, 3, 1}) ;);
                                                                                     ^
19 errors
stdout
Standard output is empty