The Full Counting Sort

  • + 5 comments

    For Java submissions, having

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    

    and then using something like

    String[] tmp = in.readLine().split(" ");
    int x = Integer.parseInt(tmp[0]);
    String s = tmp[1];
    

    instead of normal Scanner nextInt(), next() methods cuts processing time in half.

    For testcase #5 my submission times were:

    1. Success 3.97s (using Scanner and doing System.out.print(s + " ");)
    2. Success 2.21s (using Scanner and using StringBuilder for output)
    3. Success 1.03s (using the BufferedReader method shown above)

    Either way if the implementation really is good the test should pass independent of using Scanner and System.out.print for each of the items