|
|
back to boardPlease send me this solution on e-mail void438@mail.ru Posted by OpenGL 31 Jan 2009 17:37 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) Solve it first in any language, only then ask for my solution. Edited by author 08.02.2009 03:20 Re: Java solution exists 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 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 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 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 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 |
|
|