989 - Su Doku

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

Moderator: Board moderators

989 - Su Doku

Postby <:3)~~ » Mon Jan 01, 2007 6:24 pm

the problem says::
you should print 'NO SOLUTION'. For lexicographic comparison you should consider lines in first place
what does he mean by line in fst place!!
plzz tell wether my outputs are correct or not!!
INPUT::
3
0 6 0 1 0 4 0 5 0
0 0 8 3 0 5 6 0 0
2 0 0 0 0 0 0 0 1
8 0 0 4 0 7 0 0 6
0 0 6 0 0 0 3 0 0
7 0 0 9 0 1 0 0 4
5 0 0 0 0 0 0 0 2
0 0 7 2 0 6 9 0 0
0 4 0 5 0 8 0 7 0
3
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
3
0 0 0 1 0 4 0 5 0
0 0 8 3 0 5 6 0 0
2 0 0 0 0 0 0 0 1
8 0 0 4 0 7 0 0 6
0 0 6 0 0 0 3 0 0
7 0 0 9 0 1 0 0 4
5 0 0 0 0 0 0 0 2
0 0 7 2 0 6 9 0 0
0 4 0 5 0 8 0 7 0

OUTPUT::
9 6 3 1 7 4 2 5 8
1 7 8 3 2 5 6 4 9
2 5 4 6 8 9 7 3 1
8 2 1 4 3 7 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
5 8 9 7 1 3 4 6 2
3 1 7 2 4 6 9 8 5
6 4 2 5 9 8 1 7 3

1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 1 4 3 6 5 8 9 7
3 6 5 8 9 7 2 1 4
8 9 7 2 1 4 3 6 5
5 3 1 6 4 2 9 7 8
6 4 2 9 7 8 5 3 1
9 7 8 5 3 1 6 4 2

3 6 9 1 2 4 7 5 8
1 7 8 6 3 5 2 4 9
2 5 4 7 8 9 6 3 1
8 1 2 4 7 3 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
9 2 7 3 1 6 4 8 5
5 8 1 2 4 7 9 6 3
6 4 3 5 9 8 1 7 2


AND DO WE HAVE TO PRINT
NO SOLUTION
OR
'NO SOLUTION'
<:3)~~
New poster
 
Posts: 16
Joined: Wed Dec 06, 2006 6:57 pm

Postby rio » Mon Jan 01, 2007 7:15 pm

My AC code outputs
Code: Select all
9 6 3 1 7 4 2 5 8
1 7 8 3 2 5 6 4 9
2 5 4 6 8 9 7 3 1
8 2 1 4 3 7 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
5 8 9 7 1 3 4 6 2
3 1 7 2 4 6 9 8 5
6 4 2 5 9 8 1 7 3

1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 1 4 3 6 5 8 9 7
3 6 5 8 9 7 2 1 4
8 9 7 2 1 4 3 6 5
5 3 1 6 4 2 9 7 8
6 4 2 9 7 8 5 3 1
9 7 8 5 3 1 6 4 2

9 6 3 1 7 4 2 5 8
1 7 8 3 2 5 6 4 9
2 5 4 6 8 9 7 3 1
8 2 1 4 3 7 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
5 8 9 7 1 3 4 6 2
3 1 7 2 4 6 9 8 5
6 4 2 5 9 8 1 7 3

Seems different from yours.

Just print NO SOLUTION.
User avatar
rio
A great helper
 
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Postby <:3)~~ » Mon Jan 01, 2007 7:49 pm

:( sry!!my bad!!
Thx rio.
<:3)~~
New poster
 
Posts: 16
Joined: Wed Dec 06, 2006 6:57 pm

Testcase

Postby Kidz » Fri May 25, 2007 4:51 am

hi rio....

now i'm trying to solve this problem...

and I've try your testcase...

and result is same...

But when I submit in acm... they give me Wrong Answer... may be my program has still a bug in some case.... can you give me more test case...

Not only for rio... for anyone had solve this problem and want to give me test case... i say thx before....

Sory for my bad english...
Kidz
New poster
 
Posts: 2
Joined: Fri May 25, 2007 3:51 am

Postby helloneo » Fri May 25, 2007 5:03 am

Try this case..

Code: Select all
2
1 2 3 4
3 4 1 2
2 1 4 3
4 3 2 1
2
1 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0


My output is..

Code: Select all
1 2 3 4
3 4 1 2
2 1 4 3
4 3 2 1

NO SOLUTION
helloneo
Guru
 
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Thx

Postby Kidz » Fri May 25, 2007 5:16 am

Hi ... helloneo...

Thx for the test case... but my program can handle this test case...

can you give another test case....

Thx again before for that test case...
Kidz
New poster
 
Posts: 2
Joined: Fri May 25, 2007 3:51 am

Postby Kallol » Mon Aug 27, 2007 5:27 pm

well , my AC code does not output the same as Rio's one for the inputs of <:3)~~ .I think there can be more than one solutions...but I wonder how is it possible as the told to output the lexicographically smallest one to print ... and my output mismathes Rio's out put for the second input (all 0) and I think mine one is lexicographically smaller than his one ( well , i didnt check that well ...just a bird's view) ..and here is my output :
Code: Select all
9 6 3 1 7 4 2 5 8
1 7 8 3 2 5 6 4 9
2 5 4 6 8 9 7 3 1
8 2 1 4 3 7 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
5 8 9 7 1 3 4 6 2
3 1 7 2 4 6 9 8 5
6 4 2 5 9 8 1 7 3

1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 1 6 7 4 8 9 5
8 7 5 9 1 2 3 6 4
6 9 4 5 3 8 2 1 7
3 1 7 2 6 5 9 4 8
5 4 2 8 9 7 6 3 1
9 6 8 3 4 1 5 7 2

9 6 3 1 7 4 2 5 8
1 7 8 3 2 5 6 4 9
2 5 4 6 8 9 7 3 1
8 2 1 4 3 7 5 9 6
4 9 6 8 5 2 3 1 7
7 3 5 9 6 1 8 2 4
5 8 9 7 1 3 4 6 2
3 1 7 2 4 6 9 8 5
6 4 2 5 9 8 1 7 3
Syed Ishtiaque Ahmed Kallol
CSE,BUET
Bangladesh
User avatar
Kallol
Learning poster
 
Posts: 100
Joined: Sun Nov 13, 2005 8:56 am

Postby rio » Tue Aug 28, 2007 5:31 am

Heres the result of "diff" command of mine output and yours.
Code: Select all
--- rio 2007-08-28 12:23:52.000000000 +0900
+++ kallol  2007-08-28 12:23:37.000000000 +0900
@@ -11,12 +11,12 @@
 1 2 3 4 5 6 7 8 9
 4 5 6 7 8 9 1 2 3
 7 8 9 1 2 3 4 5 6
-2 1 4 3 6 5 8 9 7
-3 6 5 8 9 7 2 1 4
-8 9 7 2 1 4 3 6 5
-5 3 1 6 4 2 9 7 8
-6 4 2 9 7 8 5 3 1
-9 7 8 5 3 1 6 4 2
+2 3 1 6 7 4 8 9 5
+8 7 5 9 1 2 3 6 4
+6 9 4 5 3 8 2 1 7
+3 1 7 2 6 5 9 4 8
+5 4 2 8 9 7 6 3 1
+9 6 8 3 4 1 5 7 2

I think my solution is lexicographically smaller than yours.
----
Rio
User avatar
rio
A great helper
 
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Postby Kallol » Thu Aug 30, 2007 7:49 am

hmm ....

i c ....

but the problem statement indicates tha there should not be more than one answer , huh ?? Then , my one should not be OK :cry: .... why did I get ACC ??
Syed Ishtiaque Ahmed Kallol
CSE,BUET
Bangladesh
User avatar
Kallol
Learning poster
 
Posts: 100
Joined: Sun Nov 13, 2005 8:56 am

Postby rio » Fri Aug 31, 2007 10:24 am

Kallol wrote:hmm ....

i c ....

but the problem statement indicates tha there should not be more than one answer , huh ?? Then , my one should not be OK :cry: .... why did I get ACC ??

Well, I think there was no critical cases for your code in judge IO.
The instance number of this problem is quite large, judge IO can't be prefect.
----
Rio
User avatar
rio
A great helper
 
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Re: 989 - Su Doku

Postby r2ro » Fri Oct 09, 2009 3:36 am

Good day everyone, sorry for bumping a topic long forgotten, but I can't seem to have my code accepted. Mind pointing out anything wrong with my output?

Input:

Code: Select all
3
0 1 7 3 0 9 0 0 2
0 9 0 0 0 0 5 0 0
0 0 0 0 0 6 0 0 0
0 0 2 0 0 7 0 0 0
0 6 8 0 4 0 7 3 0
0 0 0 8 0 0 1 0 0
0 0 0 2 0 0 0 0 0
0 0 6 0 0 0 0 9 0
3 0 0 1 0 8 6 4 0

3
0 0 0 0 0 2 5 1 4
0 9 2 0 4 0 0 8 0
0 6 0 7 0 0 3 0 0
0 0 6 0 0 9 0 0 0
0 7 0 0 0 1 0 0 0
2 0 0 8 6 0 7 0 0
6 0 3 0 0 7 0 5 1
7 8 0 0 0 0 4 3 0
5 0 0 0 0 0 9 0 0

3
0 0 1 6 0 0 0 0 0
0 0 3 7 0 0 0 0 0
4 5 0 0 0 9 3 0 0
3 2 0 0 0 6 5 0 0
0 0 0 0 0 0 0 0 0
0 0 9 5 0 0 0 4 1
0 0 4 1 0 0 0 3 9
0 0 0 0 0 2 7 0 0
0 0 0 0 0 8 1 0 0

3
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

3
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

3
0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 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 9 7 6 3 1
9 6 8 3 4 1 5 7 2

NO SOLUTION

1 2 3 4
3 4 1 2
4 3 2 1
2 1 4 3

1 2 3 4
3 4 1 2
4 3 2 1
2 1 4 3

1 2 3 4
3 4 1 2
4 3 2 1
2 1 4 3

NO SOLUTION





EDIT: Oops! Got Accepted. I guess I forgot to consider Sudoku puzzles that were 1 x 1 in dimension. Silly me :lol:
r2ro
New poster
 
Posts: 17
Joined: Thu Sep 25, 2008 9:26 am


Return to Volume IX

Who is online

Users browsing this forum: No registered users and 0 guests