CSES - Leirikisa 3 - Results
Submission details
Task:Sudoku
Sender:siirikuoppala
Submission time:2016-07-29 14:26:19 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.05 sdetails
#20.05 sdetails
#30.06 sdetails
#40.05 sdetails
#50.05 sdetails

Code

#include <iostream>

using namespace std;

int t[9][9], h[3][3][10], a[9][10], b[9][10];
int main(){
    string s;
    cin >> s;
    for(int i=0; i<9; ++i){
        t[0][i]=s[i]-'0';
        h[0][i/3][t[0][i]]=1;
        a[i][t[0][i]]=1;
    }
    for(int j=1; j<9; ++j){
        for(int i=0; i<9; ++i){
            for(int x=1; x<=9; ++x){
                if(h[j/3][i/3][x]+a[i][x]+b[j][x]==0){
                    t[j][i]=x;
                    h[j/3][i/3][x]=1;
                    a[i][x]=1;
                    b[j][x]=1;
                    break;
                }
            }
        }
    }
    for(int i=0; i<9; ++i) {
        for(int j=0; j<9; ++j) cout << t[i][j];
        cout << "\n";
    }
}

Test details

Test 1

Verdict:

input
592836471

correct output
592836471
836471592
471592836
928364715
364715928
...

user output
592836471
134257689
678149235
213465798
456312000
...

Test 2

Verdict:

input
672935418

correct output
672935418
935418672
418672935
729354186
354186729
...

user output
672935418
134267590
589140236
213456789
456312000
...

Test 3

Verdict:

input
329174658

correct output
329174658
174658329
658329174
291746583
746583291
...

user output
329174658
145236790
678590123
213457869
456312070
...

Test 4

Verdict:

input
376958421

correct output
376958421
958421376
421376958
769584213
584213769
...

user output
376958421
124367589
589124367
213475698
457213000
...

Test 5

Verdict:

input
875694321

correct output
875694321
694321875
321875694
756943218
943218756
...

user output
875694321
123578469
469123578
214356780
356217940
...