10463 - Aztec Knights

All about problems in Volume CIV. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

10463 - Aztec Knights

Postby ras46 » Thu Mar 06, 2003 1:37 pm

I got wa many times ..
Is there any tricky input ?
ras46
New poster
 
Posts: 5
Joined: Mon Nov 05, 2001 2:00 am
Location: Taiwan

Postby kmhasan » Thu Mar 06, 2003 6:50 pm

it may happen that you can reach the destination in 1 move (which is composite) but you can reach it in 3 moves (which is prime).
does your solution handle those cases?
User avatar
kmhasan
Problemsetter
 
Posts: 107
Joined: Fri Oct 26, 2001 2:00 am
Location: Canada

Postby ras46 » Fri Mar 07, 2003 2:53 am

Hi,kmhasan.
I have handled this case , but still WA.

5 5 0 0 1 3
CASE# 1: The knight takes 3 prime moves.

Is my output correct?
ras46
New poster
 
Posts: 5
Joined: Mon Nov 05, 2001 2:00 am
Location: Taiwan

Postby ras46 » Fri Mar 07, 2003 5:50 am

I found a mistake in my sourcecode.
I got AC after correcting it .. :wink:
ras46
New poster
 
Posts: 5
Joined: Mon Nov 05, 2001 2:00 am
Location: Taiwan

Postby Caesum » Fri Oct 31, 2003 8:30 pm

Am I right in saying that a knight at (0,0) can move to (3,1) but that a knight at (3,1) cannot move to (0,0) since one of the intermediate moves would be off the board ?
Caesum
Experienced poster
 
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK

Postby kmhasan » Fri Oct 31, 2003 9:40 pm

No. I think if a knight can go from (0,0) to (3,1) then it can also go from (3,1) to (0,0).
User avatar
kmhasan
Problemsetter
 
Posts: 107
Joined: Fri Oct 26, 2001 2:00 am
Location: Canada

Postby Caesum » Sat Nov 01, 2003 2:02 am

any ideas for avoiding a tle on this ? at the moment i pretty much do brute force with some heuristics but it is slow........
Caesum
Experienced poster
 
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK

Postby Dmytro Chernysh » Sat Nov 01, 2003 2:04 am

The same problem Caesum...
Dmytro Chernysh
Experienced poster
 
Posts: 146
Joined: Sat Apr 26, 2003 2:51 am

Postby kmhasan » Sat Nov 01, 2003 5:05 am

Spoiler follows:

I run a IDS (Iterative Deepening Search) keeping track of the cells I visit while searching within a certain depth. If this track is kept, then we are not going to explore the cells in that depth again if it leads to unsuccessful searches.

A preprocessing with BFS can make the solution run even faster. In that case we can use the prime numbers as the depth of IDS.
User avatar
kmhasan
Problemsetter
 
Posts: 107
Joined: Fri Oct 26, 2001 2:00 am
Location: Canada

10463 Aztec knights

Postby wiltord » Mon Dec 01, 2003 6:21 am

how to understand the second data set in the sample. i can't find a two steps move from (0,0) to (4,4).
my goal: master algorithms
wiltord
New poster
 
Posts: 16
Joined: Mon Oct 27, 2003 10:10 am
Location: SiChuan, China

Postby sohel » Mon Dec 01, 2003 8:51 am

Hi Wiltord,

Perhaphs you misunderstood the question.
Aztecs Knights are special: they move three spaces horizontally/vertically and one space vertically/horizontally.

So (0,0) to (4,4):

(0,0) to (3,1) - 1st move.
(3,1) to (4,4) - 2nd move.

Hope it helps. :wink:
User avatar
sohel
Guru
 
Posts: 862
Joined: Thu Jan 30, 2003 5:50 am
Location: University of Texas at San Antonio

Postby wiltord » Mon Dec 01, 2003 11:25 am

I have found the way now,it is really i misunderstood the move rules.thank you! 8) [/quote][/cpp]
my goal: master algorithms
wiltord
New poster
 
Posts: 16
Joined: Mon Oct 27, 2003 10:10 am
Location: SiChuan, China

Postby wiltord » Mon Dec 01, 2003 4:20 pm

I run a IDS (Iterative Deepening Search) keeping track of the cells I visit while searching within a certain depth. If this track is kept, then we are not going to explore the cells in that depth again if it leads to unsuccessful searches

please tell me more specificly,how to do with the keeping track of the cells and not going to explore the cells int that depth again! thank you!
my goal: master algorithms
wiltord
New poster
 
Posts: 16
Joined: Mon Oct 27, 2003 10:10 am
Location: SiChuan, China

10463 Aztec knights how to avoid tle

Postby wiltord » Tue Dec 02, 2003 4:12 pm

who can help me? I can't really find an effective way to avoid tle. thanks before.
my goal: master algorithms
wiltord
New poster
 
Posts: 16
Joined: Mon Oct 27, 2003 10:10 am
Location: SiChuan, China

Postby Larry » Wed Dec 03, 2003 8:12 am

BFS should be enough..
Larry
Guru
 
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City

Next

Return to Volume CIV

Who is online

Users browsing this forum: No registered users and 1 guest

cron