I didn't look into your code thoroughly, but check to see if you are handling "sleeping inside danger zone" properly.
Yeah, you are right, I don't rest inside "danger zone" at all, though it is permitted to rest there during the day! thanks!
Anyway, even after including that, my code gives WA ...
Search found 23 matches
- Sun Oct 26, 2008 11:07 am
- Forum: Volume 115 (11500-11599)
- Topic: 11545 - Avoiding Jungle in the Dark
- Replies: 13
- Views: 5998
- Sat Oct 25, 2008 7:38 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11545 - Avoiding Jungle in the Dark
- Replies: 13
- Views: 5998
Re: 11545 Avoiding Jungle in the Dark
Your understanding of left of S to left of D is correct. That description was there to remove ambiguity of border regions between jungle and plain lands. It was implied that, you are strictly located on one land and one hour later, you will be located in the next, having no concern about the ...
- Sat Oct 25, 2008 6:56 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11545 - Avoiding Jungle in the Dark
- Replies: 13
- Views: 5998
11545 - Avoiding Jungle in the Dark
I don't why my code gives WA!
IMHO, I think that having S and D in the question really complicates the understanding of the problem.
I still don't understand what is the nature of S and D. Are they plains?
If they are plains, is the question about moving from left of S to left of D, or right of S to ...
IMHO, I think that having S and D in the question really complicates the understanding of the problem.
I still don't understand what is the nature of S and D. Are they plains?
If they are plains, is the question about moving from left of S to left of D, or right of S to ...
- Sun Sep 14, 2008 9:10 am
- Forum: Volume 114 (11400-11499)
- Topic: 11481 - Arrange the Numbers
- Replies: 10
- Views: 5923
Re: 11481 - Arrange the Numbers
Can you explain a little more?Robert Gerbicz wrote:Use inclusion-exclusion principle.
Inclusion and exclusion on what?
- Thu Feb 28, 2008 8:07 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11404 - Palindromic Subsequence
- Replies: 25
- Views: 18256
- Thu Feb 28, 2008 8:05 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11404 - Palindromic Subsequence
- Replies: 25
- Views: 18256
- Tue Feb 26, 2008 10:49 am
- Forum: Volume 114 (11400-11499)
- Topic: 11404 - Palindromic Subsequence
- Replies: 25
- Views: 18256
Re: 11404 Palindromic Subsequence
But in this problem you have to print the lexicographically smallest palindrom, which is the longest, and you can do that in O(|size of alphabet|*n) time. (So the total time is O(n^2))
Can you explain how you print lexicographically least palindrome with O(|size of alphabet|*n) time? I thought ...
- Sun Jan 06, 2008 1:14 pm
- Forum: Algorithms
- Topic: SPOJ MATRIX
- Replies: 0
- Views: 1703
SPOJ MATRIX
I am trying to solve this problem at SPOJ
https://www.spoj.pl/problems/MATRIX/
My naive code which is O(n^4) searches exhaustively through all the submatrices and therefore gives TLE.
I think, there must be some O(n^3) algorithm (as the one for maximal submatrix) to solve the problem.
But I am not ...
https://www.spoj.pl/problems/MATRIX/
My naive code which is O(n^4) searches exhaustively through all the submatrices and therefore gives TLE.
I think, there must be some O(n^3) algorithm (as the one for maximal submatrix) to solve the problem.
But I am not ...
- Sun Jan 06, 2008 12:57 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11377 - Airport Setup
- Replies: 24
- Views: 15809
- Sun Jan 06, 2008 12:05 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11377 - Airport Setup
- Replies: 24
- Views: 15809
- Sun Jan 06, 2008 10:49 am
- Forum: Volume 113 (11300-11399)
- Topic: 11377 - Airport Setup
- Replies: 24
- Views: 15809
I first implemented BFS, but that gave WA, even after considering x == y case.
So I implemented Djkstra noting that if x and y don't have an airport then the cost of path between them will be more than, if any one of them have airport which in turn will be more when, both have airport in it.
Is this ...
So I implemented Djkstra noting that if x and y don't have an airport then the cost of path between them will be more than, if any one of them have airport which in turn will be more when, both have airport in it.
Is this ...
- Sun Dec 30, 2007 7:58 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11375 - Matches
- Replies: 18
- Views: 10428
If u are using C style char array to store the number, make sure it is terminated by '\0'Leonid wrote:The sample of my outputCode: Select all
0 1 2 4 .......
I remeber doing such silly mistake in some other problem, which prevented me from getting AC
Better post the code, so that we could try to spot the bug.
- Tue Dec 04, 2007 9:43 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10061 - How many zero's and how many digits ?
- Replies: 43
- Views: 28836
- Sun Nov 25, 2007 2:16 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11353 - A Different Kind of Sorting
- Replies: 17
- Views: 9475
- Sat Nov 24, 2007 9:37 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11353 - A Different Kind of Sorting
- Replies: 17
- Views: 9475