28 / 28
Jan 2015

Sure. The numbers I gave are just for having some general idea of the impact in the version update. Some of the solutions can get AC by optimizing the algorithm (when I see an easy time constraint problem, I usually prefer a clean/easy/'fast enough' solution), but my personal impression is still many (extra) problems would not get acceptable. But it is just my (non-expert) point of view.

Just some facts:

CLTZ:
2.5 .... 2.62
2.6.1 .... 2.97
2.6.2 .... 3.92

STAMPS:
2.5 .... 0.64
2.6.1 .... 1.14
2.6.2 .... 1.54

I dont think the Python developers have made their homework. They should do some exercises on SPOJ instead. Soon we get TLE on TEST. imp
Can we resume to 2.5?

Just some other facts (= my solutions for STAMPS):
Python 2.5 ... 0.62 s
Python 2.6 ... 0.68 s

Excellent of course. No doubt. The question is: Have you changed the code meanwhile? I havent. I just submitted the code as is. If you want to compare something you have to keep something constant.
Submit your CLTZ solution.

CLTZ:
Python 2.5.x .... 1.26 s (0.81 with psyco)
Python 2.6.2 .... 2.31 s (1.68 s with psyco)

It is as I said before: There are some problemsets where you can optimize your code so that there is only little loss of performance, there are others (like CLTZ), where you can't. But nevertheless: You can get your solution to CLTZ get AC, even with Python 2.6.2 and without psyco. It isn't as fast as before, but - "what shalls" (as we Germans like to say ... )

9 days later

Then improve your algorithm ... smile
(My solution run in 3.65 s with python 2.5 and runs is 4.23 s with python 2.6.2.)

What algorithm? smile In my code only a dozen of lines. Nothing to improve.

PS
I vote for switching back to Python 2.5 smile

If the time limit is 7 s and there are python solutions AC in < 5 s and your solution gives TLE: There IS something to improve!

If the time limit is 7 s and there are python solutions AC in < 5 s and your solution gives TLE: There IS something to improve!

I have in store my ACcepted C++ code smile

PS
Adding Sevens: spoj.pl/ranks/ANARC08B/lang=PYTH
All of this summer submissions (i.e. v.2.5). Today my py code gets only TLEs (I've never solved this prob before).

Then improve your algorithm ... wink
I submitted my old solution today (python 2.6.2) and got AC in 0.80 s with pure python and 0.30 s with psyco.

What can be improved in my TLE code?

import psyco
psyco.full()
def foo():
    a = (\
        '063',
        '010',
        '093',
        '079',
        '106',
        '103',
        '119',
        '011',
        '127',
        '107')
    b = {\
    '063':'0',
    '010':'1',
    '093':'2',
    '079':'3',
    '106':'4',
    '103':'5',
    '119':'6',
    '011':'7',
    '127':'8',
    '107':'9'}

import sys
w = sys.stdin.readlines()

for wi in w:
    s = wi.strip()
    if s == 'BYE':
        return
    p = s[:s.index('+')]
    q = s[s.index('+') + 1:][:-1]
    pp = ''
    for i in range(0, len(p), 3):
        pp += b[p[i:i + 3]]
    qq = ''
    for i in range(0, len(q), 3):
        qq += b[q[i:i + 3]]
    z = str(int(pp) + int(qq))
    r = ''
    for zi in z:
        r += a[int(zi)]
    print s + r
foo()

Testdata is available (see link in the bottom of problem description), so find the bottleneck by doing some profiling. Then you'll find out yourself.

alas... my dial-up connection is too slow for downloading anything with size more than 1-2MB

You don't need official testdata to find the bottleneck(s). Just create your own testdata.

4 years later

Forum jest po to aby odpowiadać na pytania? Niestety, "ale nie mam innego pomysłu" to nie pytanie wink , mimo to jeszcze raz "powiem":
Jest algoliga.pl1 a tam z lewego boku, taki mały, podobny do tego tu na spoju, niebieski napis [color=#4000BF][b]forum[/b][/color]. "Idąc" tam warto wcześniej odblokować w swojej przeglądarce wykonywanie skryptów.

PS
W zasadzie wystarczyłoby tylko zwrócić uwagę na pierwszy link w moim podpisie.

11 months later

Jak napiszesz to przeczytam. Mogę nawet wrzucić to zadanie do mojego folderu "SPOJ TODO" żeby było jednym z następnych które rozwiąże (może nawet zanim zaczniesz pisać smile)

Więc, zaro, zacznij robić zadanie, bo póki nie zrobisz, nic nie napiszę wink
Optymalizacje powinno się robić i nawet zaczynać myśleć dopiero po AC, a nie WA czy TLE czy nawet ani jedno z trzech [nie rozwiązanie ani nie przemyślenie zadania np na kartce w kratkę]

No ale dobra, jak będziesz już zdesperowany to zerknij: forum.algoliga.pl/viewtopic.php?f=6&t=55

Zaliczyłem zadanie i przy okazji poznałem algorytm lidera. Domyślam się że pewne układy parametrów sprzyjają powtarzaniu elementów jak na przykład mały... modulus (g)?