Re: Enormous Input and Output Test

2009-10-10 Thread Irmen de Jong
John Yeung wrote: P.S. I hope people realize that the concise, intuitive, readable answers we all tried in our first couple of (failed) attempts are much more Pythonic than the beasts that were created just for SPOJ. Well, it is not often that we need to micro optimize stuff (or how would you

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
N00m The Instigator... hahaha :-) I always wish I was a producer, an entertainer, an impressario, or even a souteneur (kidding). Life is complex: it has both real and imaginary parts. Some producer (Mr. Gomelsky) nicknamed Eric Clapton as "Slow Hand", many years ago. Gomel is my native town and ap

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
Congrats, Irmen. PS > so I think 7.5 seconds for the fastest ... It's becoming crazy :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-08 Thread n00m
numerix's solution was excelled by Steve C's one (8.78s): http://www.spoj.pl/ranks/INOUTEST/lang=PYTH I don't understand nothing. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-07 Thread John Yeung
On Oct 7, 4:35 pm, Irmen de Jong wrote: > I just got my solution accepted, it ran in 14 seconds though. Hey, that's pretty good. Until n00m instigated the most recent INOUTEST craze, the only accepted answer besides numerix's was one that barely squeaked in at 19.81s, and that result was achieve

Re: Enormous Input and Output Test

2009-10-07 Thread Irmen de Jong
n00m wrote: numerix's solution was excelled by Steve C's one (8.78s): http://www.spoj.pl/ranks/INOUTEST/lang=PYTH I don't understand nothing. I just got my solution accepted, it ran in 14 seconds though. I have no idea how to shave more seconds off, so I think 7.5 seconds for the fastest solu

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
What happened to performance of ver.2.6.2 (vs ver.2.5.x)? https://www.spoj.pl/forum/viewtopic.php?f=20&t=5949 -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
> This takes 5 second on my machine using a file with 1,000,000 random... Surely it will fail to pass time limit too -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-06 Thread n00m
> 50-80%% of users from the 1st page in ranklist are > super-extra-brilliant #5 there: http://www.spoj.pl/users/tourist/ This 14 y.o. schoolboy won IOI 2009, in this August, and he's about to get into Guiness' book as the youngest winner for all the history of international olympiads on informatic

Re: Enormous Input and Output Test

2009-10-05 Thread nn
On Oct 4, 8:41 am, Duncan Booth wrote: > Jon Clements wrote: > > On Oct 4, 12:08 pm, n00m wrote: > >> Duncan Booth, > > >> alas... still TLE: > > >> 2800839 > >> 2009-10-04 13:03:59 > >> Q > >> Enormous Input and Output Test &

Re: Enormous Input and Output Test

2009-10-05 Thread n00m
Duncan Booth, alas... still TLE: 2800839 2009-10-04 13:03:59 Q Enormous Input and Output Test time limit exceeded - 88M PYTH -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-05 Thread n00m
> but unlike us, he's routinely under 11s. Crazy. No wonder! 50-80%% of users from the 1st page in ranklist are super-extra-brilliant (young students) programmers. They are winners of numerous competitions, national and international olympiads on informatics, etc. Some of them are/were even true

Re: Enormous Input and Output Test

2009-10-04 Thread Duncan Booth
Jon Clements wrote: > On Oct 4, 12:08 pm, n00m wrote: >> Duncan Booth, >> >> alas... still TLE: >> >> 2800839 >> 2009-10-04 13:03:59 >> Q >> Enormous Input and Output Test >> time limit exceeded >> - >> 88M >> PYTH >

Re: Enormous Input and Output Test

2009-10-04 Thread Jon Clements
On Oct 4, 12:08 pm, n00m wrote: > Duncan Booth, > > alas... still TLE: > > 2800839 > 2009-10-04 13:03:59 > Q > Enormous Input and Output Test > time limit exceeded > - > 88M > PYTH Just to throw into the mix... What about buffering? Does anyone know what the

Re: Enormous Input and Output Test

2009-10-04 Thread Duncan Booth
n00m wrote: > > I've given up :-) Here's my attempt, which is about 30% faster than your original but I've no idea if it would be fast enough for you. import sys, time, os, itertools import gc gc.set_threshold() D = [] def foo(): ##sys.stdin = open('D:/1583.txt', 'rt') count = int

Re: Enormous Input and Output Test

2009-10-04 Thread Bearophile
Terry Reedy: > Don't waste your time with problem sites that judge raw-clock time over > (and before) accuracy, thereby greatly favoring low-level languages and > hack tricks over clear high-level code. I usually don't like to solve the kind of problems shown by those sites because those problems

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 4:20 am, n00m wrote: > I've given up :-) Well, that numerix user (who already had the top Python solution) just submitted a ton of new ones to that problem, apparently trying to get a faster time. I don't think he can squeeze much more out of that stone, but unlike us, he's routinely u

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
It can be not so "simple". There can be multiple input files, with *total* size ~30-50-80 MB. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
This time limits too: = import psyco psyco.full() import sys def foo(): ##sys.stdin = open('D:/1583.txt', 'rt') a = sys.stdin.readlines() a = a[1:int(a[0]) + 1] for ai in a: x, y = ai.split() sys.stdout.write(str

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
PS Yes, they support psyco since long time ago (otherwise I'd get Compilitation Error verdict). I used Psyco there many many times. -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 1:50 am, n00m wrote: > It can be not so "simple". > There can be multiple input files, > with *total* size ~30-50-80 MB. According to one of the global moderators, the 20s time limit is for each input file: https://www.spoj.pl/forum/viewtopic.php?f=6&t=4667 John -- http://mail.pyth

Re: Enormous Input and Output Test

2009-10-04 Thread n00m
I've given up :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
And this code time limits (no matter with or without Psyco): import psyco psyco.full() import sys def foo(): ##sys.stdin = open('D:/1583.txt', 'rt') sys.stdin.readline() while 1: try: x, y = sys.stdin.readline().split() sys.stdout.write(str(int(x) * in

Re: Enormous Input and Output Test

2009-10-03 Thread John Yeung
On Oct 3, 11:58 pm, n00m wrote: > > Do you know how big the input data set actually is? > > Of course, I don't know exact size of input. > It's several MBs, I guess. And mind the fact: > their testing machines are PIII (750MHz). You know the maximum size of the input, if you can trust the problem

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
And *without* Psyco the above code gets TLE verdict... A kind of mystery :( -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
> On my machine, the above code handles ~50MB in ~10sec. Means their input > 40-50MB 2. I just see: two guys did it in Python and I feel myself curious "how on earth?". -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 4, 1:58 pm, n00m wrote: > > Do you know how big the input data set actually is? > > Of course, I don't know exact size of input. > It's several MBs, I guess. And mind the fact: > their testing machines are PIII (750MHz). Well, then, that's moved the problem from "challenging" to "ludicrous

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
> Do you know how big the input data set actually is? Of course, I don't know exact size of input. It's several MBs, I guess. And mind the fact: their testing machines are PIII (750MHz). -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 3, 11:54 pm, n00m wrote: > I need your help to understand howhttp://www.spoj.pl/problems/INOUTEST/ > can be passed in Python. > > My code for this is: > === > import psyco > psyco.full() > > import sys > > def noo(b): >     b = b.split() >     return

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
PS Time Limit for this problem = 20s -- http://mail.python.org/mailman/listinfo/python-list

Re: Enormous Input and Output Test

2009-10-03 Thread n00m
On Oct 4, 2:29 am, Chris Rebert wrote: > > That line is probably a Very Bad Idea (TM) as it reads the *entire* > enormous file into memory *at once*. It would probably be much better > to iterate over the file, thus only reading one individual line at a > time. I'm betting the massive malloc()ing

Re: Enormous Input and Output Test

2009-10-03 Thread Terry Reedy
n00m wrote: Hi, py.folk! I need your help to understand how http://www.spoj.pl/problems/INOUTEST/ can be passed in Python. I see two guys who managed to get accepted: http://www.spoj.pl/ranks/INOUTEST/lang=PYTH My code for this is: === import psyco psyco

Re: Enormous Input and Output Test

2009-10-03 Thread Chris Rebert
On Sat, Oct 3, 2009 at 6:54 AM, n00m wrote: > Hi, py.folk! > > I need your help to understand how > http://www.spoj.pl/problems/INOUTEST/ > can be passed in Python. > def foo(): >    ##sys.stdin = open('D:/1583.txt', 'rt') >    a = sys.stdin.readlines() That line is probably a Very Bad Idea (TM)

Enormous Input and Output Test

2009-10-03 Thread n00m
Hi, py.folk! I need your help to understand how http://www.spoj.pl/problems/INOUTEST/ can be passed in Python. I see two guys who managed to get accepted: http://www.spoj.pl/ranks/INOUTEST/lang=PYTH My code for this is: === import psyco psyco.full() impor