ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1167. Bicolored Horses

Why Memory Limit Exceeded?????HELPHELPHELPHELPHELP
Posted by King Without Kingdom 25 Sep 2002 03:04
[deleted by moderator]

Edited by moderator 13.04.2004 07:47
Re: Why Memory Limit Exceeded?????HELPHELPHELPHELPHELP
Posted by Petar Zhivkov Petrov 25 Sep 2002 19:44
 You may use 'short int' instead of 'int' sizeof(int) == 4, sizeof
(short int) == 2, according to the timus's compiler. So unsigned
short int is enough. Even if this program fits in the memory limit,
it will get TL. You have complexity of O(N^3). Mine was the same, it
needs 3-4 secs. for N=500 K=300. I'm now wondering how to solve this
problem.
Re: Why Memory Limit Exceeded?????HELPHELPHELPHELPHELP
Posted by sloboz 13 Apr 2004 05:32
you must use longint not just int, but O(N) memory. O(N^3) works, don't know if N^2 possible