ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1306. Медиана последовательности

Java solution exists
Послано Fyodor Menshikov 31 янв 2009 03:27
Please send me this solution on e-mail void438@mail.ru
Послано OpenGL 31 янв 2009 17:37
Sent
Послано Fyodor Menshikov 31 янв 2009 20:09
Thanks
Послано OpenGL 31 янв 2009 22:40
If you can, please send me this solution too (astroori@mail.ru)
Послано KA50 7 фев 2009 10:55


Edited by author 07.02.2009 10:56
Re: If you can, please send me this solution too (astroori@mail.ru)
Послано Fyodor Menshikov 8 фев 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
Послано Fyodor Menshikov 8 фев 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
Послано KA50 8 фев 2009 15:31
Thanks
Re: Java solution exists
Послано xurshid_n 28 мар 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
Послано AterLux@Java 25 май 2011 02:22
Re: Java solution exists
Послано scythe 16 дек 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
Послано holydragon 4 мар 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
Послано ucs6 24 апр 2012 11:51
I got AC with 858KB memory
Re: Java solution exists
Послано relator 26 авг 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
Послано Ozzy 11 апр 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
Послано Altynbek 7 авг 2013 15:39
how to send solution with java? in language list, i haven't got java.
Re: Java solution exists
Послано DrhF 26 янв 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