CSES - Putka Open 2015 – 2/6 - Results
Submission details
Task:Sudoku
Sender:
Submission time:2015-08-16 17:58:20 +0300
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2ACCEPTED0.06 sdetails
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.05 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:17:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%c", &c);
                        ^

Code

#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>

using namespace std;

typedef signed long long int ll;
typedef unsigned long long int ull;

int board[9][9] = {{0}};

int main() {
    for (int i = 0; i < 9; ++i) {
        char c;
        scanf("%c", &c);
        board[0][i] = c - '0';
    }

    for (int i = 0; i < 9; ++i) {
        board[1][i] = board[0][(i+3)%9];
        board[2][i] = board[0][(i+6)%9];
    }

    for (int i = 0; i < 9; ++i) {
        for (int j = 0; j < 3; ++j) {
            board[j+3][(i+1)%9] = board[j][i];
            board[j+6][(i+2)%9] = board[j][i];
        }
    }

    for (int r = 0; r < 9; ++r) {
        for (int c = 0; c < 9; ++c) {
            cout << (board[r][c]);
        }
        cout << endl;
    }

    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
592836471

correct output
592836471
836471592
471592836
928364715
364715928
...

user output
592836471
836471592
471592836
159283647
283647159
...

Test 2

Verdict: ACCEPTED

input
672935418

correct output
672935418
935418672
418672935
729354186
354186729
...

user output
672935418
935418672
418672935
867293541
293541867
...

Test 3

Verdict: ACCEPTED

input
329174658

correct output
329174658
174658329
658329174
291746583
746583291
...

user output
329174658
174658329
658329174
832917465
917465832
...

Test 4

Verdict: ACCEPTED

input
376958421

correct output
376958421
958421376
421376958
769584213
584213769
...

user output
376958421
958421376
421376958
137695842
695842137
...

Test 5

Verdict: ACCEPTED

input
875694321

correct output
875694321
694321875
321875694
756943218
943218756
...

user output
875694321
694321875
321875694
187569432
569432187
...