1618 - Positions

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
Post Reply
User avatar
dovier
Posts: 1143
Joined: 7 years ago
Location: Havana, Cuba
Gender: Male
Cuba

1618 - Positions

Post by dovier » 7 years ago




User avatar
padrinoIJ
Posts: 13
Joined: 7 years ago
Location: CUJAE
Gender: None specified

Re: 1618 - Positions

Post by padrinoIJ » 7 years ago

WHY???? Time limited exceeded for a simple problem,

Code: Select all

b = (a+b>=n) ?  n - a : b+1;
with this code i have received tle test 1, but my friend with this same code received AC months ago, lately the server is having problems... two short code solutions give me TLE, please, read this post and answer me, I am disenchanted with the system, .........

User avatar
JJRZ
Posts: 13
Joined: 7 years ago
Location: UH
Gender: None specified

Re: 1618 - Positions

Post by JJRZ » 7 years ago

I just did the same and I got an TLE, then I submited in C++ and I got an WA in the test 1... What am I doing wrong :?:
After thinking a little, this problem is very simple, I can't find the trap!! :x

User avatar
ymondelo20
Posts: 1968
Joined: 7 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

Re: 1618 - Positions

Post by ymondelo20 » 7 years ago

Because the number of cases where the input is large, small differences between solutions may represent a cosiderable timeframe between both times.
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

User avatar
padrinoIJ
Posts: 13
Joined: 7 years ago
Location: CUJAE
Gender: None specified

Re: 1618 - Positions

Post by padrinoIJ » 7 years ago

Thanks by suggestions, greetings ;)

User avatar
ymondelo20
Posts: 1968
Joined: 7 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

Re: 1618 - Positions

Post by ymondelo20 » 7 years ago

The time was updated... 500 MS more, due to Java and C#.
However, optimal solutions may pass only with 1000 MS :)
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

Post Reply

Return to “Problem set”