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 1306. Sequence Median

Please send me this solution on e-mail void438@mail.ru
Posted by OpenGL 31 Jan 2009 17:37
Sent
Posted by Fyodor Menshikov 31 Jan 2009 20:09
Thanks
Posted by OpenGL 31 Jan 2009 22:40
If you can, please send me this solution too (astroori@mail.ru)
Posted by KA50 7 Feb 2009 10:55


Edited by author 07.02.2009 10:56
Re: If you can, please send me this solution too (astroori@mail.ru)
Posted by Fyodor Menshikov 8 Feb 2009 03:18
Solve it first in any language, only then ask for my solution.

Edited by author 08.02.2009 03:20
Re: Java solution exists
Posted by Fyodor Menshikov 8 Feb 2009 04:47
Hints:
1. Do not use many 'new' operators. I used only one int array to store data.
2. Avoid PrintWriter.printf/String.format for writing answer, it may be written using only int arithmetic.
3. Read input using StreamTokenizer or the following Scanner:

class Scanner {

   InputStream in;
   char c;

   Scanner(InputStream in) {
      this.in = in;
      nextChar();
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   void nextChar() {
      try {
         c = (char)in.read();
      } catch (IOException e) {
         throw new Error(e);
      }
   }

   long nextLong() {
      while (true) {
         if ('0' <= c && c <= '9') {
            break;
         }
         asserT(c != -1);
         nextChar();
      }
      long value = c - '0';
      nextChar();
      while ('0' <= c && c <= '9') {
         value *= 10;
         value += c - '0';
         nextChar();
      }
      return value;
   }

   int nextInt() {
      long longValue = nextLong();
      int intValue = (int)longValue;
      asserT(intValue == longValue);
      return intValue;
   }
}
Re: Java solution exists
Posted by KA50 8 Feb 2009 15:31
Thanks
Re: Java solution exists
Posted by xurshid_n 28 Mar 2010 01:30
My Java solution better from all Java solutions: 0.171 s time & 862KB memory. I use only System.in & System.out. good like.
Re: Java solution exists
Posted by AterLux@Java 25 May 2011 02:22
Re: Java solution exists
Posted by scythe 16 Dec 2011 03:39
Use something like
            System.out.print( (a+b)/2 );
            if ( (a+b) % 2==0){
            } else {
                System.out.println(".5");
            }

instead of System.out.printf or String.format if you want to get AC
Re: Java solution exists
Posted by holydragon 4 Mar 2012 15:19
I cannot solve this problem.
could you tell me more hint via my email please?
here is my e-mail => holyporing@hotmail.com

i really want to do this. Thank you.
Re: Java solution exists
Posted by ucs6 24 Apr 2012 11:51
I got AC with 858KB memory
Re: Java solution exists
Posted by relator 26 Aug 2012 02:07
 I have tried two methods to solve this problem:

1) using PriorityQueue
2) sorting using Arrays.sort

but bumped into MLE on 7th test again and again  :(

so more hints are welcomed :)
Did you write your own heap or u are using complete different approach?
Re: Java solution exists
Posted by Ozzy 11 Apr 2013 12:00
Can anyone tell me how memory 1 Mb can be exeeded if I use the PriorityQueue with size = N/2+1 and four int variables ?
How many bytes are consumed by one element of PQ ?

TIA.
Re: Java solution exists
Posted by Altynbek 7 Aug 2013 15:39
how to send solution with java? in language list, i haven't got java.
Re: Java solution exists
Posted by DrhF 26 Jan 2014 19:26
Please, send your java solution on e-mail lo.de.wash.boleem@mail.ru

Edited by author 26.01.2014 19:26

Edited by author 26.01.2014 19:27