← Back to topics
Topic

kamen

M
MilosRadic
this is a task from serbian regional contest
i sorted all the arrays for 'A' to 'Z' char and then i add the minimal valuesd but what should i do to make it more efficient since i get TLE on 2 test cases
b
boris4
use some quicker sort :D
M
MilosRadic
i used selection sort
what sort is faster?:D
i work in pascal so i guess the speed of reading in pascal is lower than in C so it is also one of the reasons of TLE
A
Al3kSaNdaR
No no no, you must use quick sort or heap sort. If you use Free Pascal you'll have quick sort in Examples folder so learn it. You'll need it for many tasks and of course for competitions.
M
MilosRadic
ok will do it up to now i only now selection sort and bubble sort and i was really wondering why doesnt this work but now i realise...thanks guys:D
and how should i solve the task MaxGCD.
i used euclids algorithm and i get 2 TLE
A
Al3kSaNdaR
My code for MaxGCD is very similar to yours and it passed ... Try to submit in GPC, I think that you'll avoid TLE by doing that. :)
A
Al3kSaNdaR
Version of Pascal, but it's faster on Z-Trening than Free Pascal . Just use GPC as your default language . ;)
M
MilosRadic
OK thanks now it has passed.is this pascal available to use in the competitions
A
Al3kSaNdaR
No you just need to use it on Z-Trening, on competition regular Pascal works fine I think .