ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1100. Final Standings

Test # 11. SOS
Posted by KBTU_10 8 Dec 2006 11:15
I'm getting f**ing TL on the test 11.
I'm using java and solved the problem as it is supposed to be in JAVA. I used objects "standings" which contains id and m( i.e. standing( id, m ) ). I'm using bubble sort since quicksort gives wrong answer.
Does anyone know how to gid rid of the Time Limit using JAVA? I know JAVA is slowest compiler i've ever seen :-)
Please, need help
Re: Test # 11. SOS
Posted by WangKaixiang 11 Aug 2008 01:59
I use JAVA.
On #11  TL too......1.015senconds...
There are some hits:
1.don't use class,it will use a lot of time.
2.Using Scanner and PrintWriter can help you input/output
a little faster.
3.I use a O(n) method....1.015senconds TL...JAVA is slow
Re: Test # 11. SOS
Posted by WangKaixiang 11 Aug 2008 02:36
AC!!
1.A O(n) method
2.in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  //for input
3.PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    //for output
4.out.print(id);
  out.print(" ");
  out.println(m);   //print them one by one for fast output

0.984s  &  8 402 KB    WTF!:)

Edited by author 11.08.2008 02:38
Re: Test # 11. SOS
Posted by wrbuaa2005 15 Aug 2008 07:54
There are only 101 Ms, so you just appear to be a little "stupid"


    for(i=100;i>=0;i--){
        for(j=0;j<N;j++)
            if(stu[j].M == i)
                printf("%d %d\n", stu[j].ID, stu[j].M);
        }