10795  A Different Task
Moderator: Board moderators
10795  A Different Task
Is the following input arrangement valid?
Input :
3
3 2 1
3 1 2
Input :
3
3 2 1
3 1 2
Last edited by TISARKER on Sat Dec 18, 2004 5:37 pm, edited 2 times in total.
Mr. Arithmetic logic Unit
 alu_mathics
 Learning poster
 Posts: 55
 Joined: Sat Jan 24, 2004 9:30 pm
 Location: Chittagong
 Contact:
 alu_mathics
 Learning poster
 Posts: 55
 Joined: Sat Jan 24, 2004 9:30 pm
 Location: Chittagong
 Contact:
3
3 2 1
3 1 2
for ur input the graph matrix would be
1 2 3 4 5 6
1 0     
2  0    
3 2 1 0   
4    0  
5     0 
6      0
here '' stands for infinity.
the matrix need to be 6*6 atleast.as u want to find a rally point from which the fr five positions are in unidistance.
as u can not find no such point after running floyd or whatever u want u find , output 1.
hope it makes u clear.
3 2 1
3 1 2
for ur input the graph matrix would be
1 2 3 4 5 6
1 0     
2  0    
3 2 1 0   
4    0  
5     0 
6      0
here '' stands for infinity.
the matrix need to be 6*6 atleast.as u want to find a rally point from which the fr five positions are in unidistance.
as u can not find no such point after running floyd or whatever u want u find , output 1.
hope it makes u clear.
cuii e
 little joey
 Guru
 Posts: 1080
 Joined: Thu Dec 19, 2002 7:37 pm
Re: 10795(A different Task)>What do u mean by valid arran
The 7 moves are:TISARKER wrote:Is the following input arrangement valid?
Input :
3
3 2 1
3 1 2
move disk 1 from 3 to 1
move disk 2 from 2 to 3
move disk 1 from 1 to 3
move disk 3 from 1 to 2
move disk 1 from 3 to 2
move disk 2 from 3 to 1
move disk 1 from 2 to 3
Hope it helps.

 New poster
 Posts: 7
 Joined: Sat Jul 09, 2005 7:58 pm
10795 getting WA
getting WA
I have tried my program with the following IO
if any body who made this accepted please give some more IO
verified with your program.
I have tried my program with the following IO
Code: Select all
input:
5
1 1 1 1 1
2 3 1 2 3
5
2 3 1 2 3
3 3 3 3 3
5
1 1 1 1 1
3 3 3 3 3
5
1 1 1 1 1
3 1 2 2 1
6
1 1 1 2 2 2
2 2 2 3 3 3
9
1 2 3 3 2 1 1 2 3
3 2 1 1 2 3 3 2 1
4
1 1 1 1
2 2 2 3
4
1 1 1 2
1 1 1 3
4
1 1 1 1
1 1 1 1
3
1 1 1
2 2 2
3
1 2 3
3 2 1
0
output:
Case 1: 21
Case 2: 10
Case 3: 31
Case 4: 13
Case 5: 56
Case 6: 219
Case 7: 8
Case 8: 1
Case 9: 0
Case 10: 7
Case 11: 3
verified with your program.
Last edited by Ahmed_Hasan on Sun Sep 25, 2005 5:24 pm, edited 2 times in total.
I think you've partially posted your inputs because the last 7 outputs you've posted corresponds to the 7 inputs but the 1st 4 inputs are missing. The inputs that you've posted here produces the correct output (i.e. the last 7 outputs are correct for your 7 inputs).
I can't remember exatly whether u need unsigned long long or not but my code has unsigned long long so may be you can try that.
If even that fails then tell me about your algo then may be I can try to find your mistake.
best of luck.
regards...
I can't remember exatly whether u need unsigned long long or not but my code has unsigned long long so may be you can try that.
If even that fails then tell me about your algo then may be I can try to find your mistake.
best of luck.
regards...
Re: 10795  A Different Task
how to solve this problem?
i have no idea. is it there are any formula?
i need some help, thx.
i have no idea. is it there are any formula?
i need some help, thx.