Sudoku SolverProblem code: NSUDOKU |
All submissions for this problem are available.
Quoting Wikipedia : "Sudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9 9 grid so that each column, each row, and each of the nine 3 3 boxes (also called blocks or regions) contains the digits from 1 to 9 only one time each. The puzzle setter provides a partially completed grid." The rules for an N2 X N2 sudoku are as follows :
- The board is consists of N2 rows and N2 columns.
- Numbers between 1 and N2(inclusive) are to be filled in each row such that :
- All numbers in each row are distinct.
- All numbers in each column are distinct.
- All numbers in the sub-matrix having rows from (i*N + 1) to(i + 1)*N, and columns from (j*N + 1) to (j + 1)*N both inclusive, should be distinct. 0 <= i,j <= N-1. Rows and columns are 1 indexed. Each such sub-matrix is called a "box" or "region".
Input :
The first line contains N,K. The following K lines contain 3 numbers: x, y and d. 1 <= x,y,d <= N^2. This means that a number d is present on the board at position (x,y) 2 <= N <= 30 0 <= K <= N4 At most 50% of the board will be covered at the start. All positions (x,y) in the input will be unique.
Output :
The output consists of N2 rows having N2 numbers each. Each number should be between 1 and N2 (inclusive) and separated by a space. If the initial grid has a number d at position (x,y), then even the output should have the number d at position (x,y).
Scoring :
- For each row and every number K in the range 1 to N2 that is missing from the row, incurs a penalty of 1.
- For each column and every number K in the range 1 to N2 that is missing from the column, incurs a penalty of 1.
- Similary, for each box and every number K in the range 1 to N2 that is missing from the box, incurs a penalty of 1.
Example :
Input:
2 4 1 2 1 2 4 4 3 3 1 4 1 3
Output:
2 1 3 4 1 2 4 4 3 4 1 2 3 2 4 1
Penalty:
(0 + 1 + 0 + 0) + (1 + 1 + 1 + 1) + (2 + 2 + 1 + 1) = 11| Author: | admin |
| Date Added: | 11-08-2009 |
| Time Limit: | 3 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Scoring doesn't seem to be
Scoring doesn't seem to be working.
Will the codes submitted for
@Keshav Yes. @Stephen Could
@Keshav Yes.
@Stephen Could you be more specific ?
Unless I've misread something
Unless I've misread something somewhere, this was going to function exactly like the challenge problem in other contests - but I don't see what score I got for my accepted solution. Will the scores for each submission be completely private until the end of the contest?
We are looking into this.
We are looking into this. There is no problem with the scoring as such, the only problem is that it's not getting displayed. Will be fixed soon.
scoring is not visible
Is it possible, that given
hey i got a compiler error
@Ankit Check out
@Ankit Check out www.codechef.com/help for information related to a sample submission in your language. Also check the FAQ.
@Keshav We are all ears. You can mail us why you think we should not make codes publicly available at admin@codechef.com
What should be the name of my
www.codechef.com/help
www.codechef.com/help
Is it possible that a penalty
@ Keshav : Just like it wasnt
I am new here.So may be i
@niraj Everyone gets the same
@niraj Everyone gets the same input. As such, the initial penalty faced by everyone would be the same. This is not necessarily Sudoku in the most traditional form.
Is there any per day limit on
no
no
How are the scores
@Neal : Its total
Do we have read the input
Input and output is done via
Input and output is done via console. You have to read from the standard input (stdin) and the output should go to standard output (stdout)
What does the time column
What are the memory
For some reason I'm receiving
@Anoop There are multiple
@Anoop There are multiple test cases. For each test case, the time limit is 3 seconds. The time shown in the time column is the sum of the times taken for each test case. If your program exceeds the 3 second time limit for any test case, then you would get a Time Limit Exceeded error.
@Rahul The judge guarantees 64 MB of memory for a submission
@Neal Are you still getting a compile error? It seems this has been sorted out. Mail us the submission id at admin@codechef.com if you continue to get a compile error.
What constitutes a wrong
When you do not follow the
Yeah, but I am following the
Well, there have been enough
Well, there have been enough accepted solutions to imply it isn't something wrong with the judge, you must be doing something wrong. Perhaps mixing up rows/columns with the given input numbers.
It's kind of funny... the
Mere input/output and
@Admin: What's the problem?
@Anoop You probably need
@Anoop You probably need faster input / output in your language.
Unlike the previous contest I
Are the prizes mentioned
@Imran This will be fixed
@Imran This will be fixed before the next contest.
@sivaraman The contest is open to all.
whats the time limit for this
When does the contest end?
ends 530 US Eastern Time
Well fought, Anshuman :)
Well fought, Anshuman :)
@Stephen Thanks. You were
@Admin: when will the
Tomorrow.
Tomorrow.
who all are eligible to view
Hey i am eager to view the
hey why are the solutions to
That is what i am asking..no
@Admin: why are the solutions
Sorry for the delay. This is
Sorry for the delay. This is now fixed.
How is the score shown with
How is the score shown with the tick mark calculated?
It is the sum of the
It is the sum of the penalties for the different test cases.
@Admin: Then how come it is a
@Admin: Then how come it is a fraction?
Sorry for that, it is the
Sorry for that, it is the average of the scores for the different test cases.
#include<stdio.h> main() {
#include<stdio.h>
main()
{ int a=10;
int b =20;
int c;
c= a+b;
printf("%d",c);
}
yes thanks stephen very
yes thanks stephen very impressive :)
____________________
sudoku solver developer sudoku solver solve sudoku instantly