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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:32:21: warning: unused variable 'off' [-Wunused-variable]
                 int off = (idx-1)%3;
                     ^

Code

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

char buf[9][10];

int main() {
    cin >> buf[0];
    copy(buf[0]+3, buf[0]+6, buf[1]);
    copy(buf[0]+6, buf[0]+9, buf[2]);

    copy(buf[0], buf[0]+3, buf[2]+3);
    copy(buf[0]+6, buf[0]+9, buf[1]+3);

    copy(buf[0], buf[0]+3, buf[1]+6);
    copy(buf[0]+3, buf[0]+6, buf[2]+6);

    for (int i = 3; i < 6; ++i) {
        for (int b = 0; b < 3; ++b) {
            for (int k = 0; k < 3; ++k) {
                int idx = b*3 + k;
                buf[i][b*3 + (idx + 1)%3] = buf[i-3][idx];
            }
        }
    }

    for (int i = 6; i < 9; ++i) {
        for (int b = 0; b < 3; ++b) {
            for (int k = 0; k < 3; ++k) {
                int idx = b*3 + k;
                int off = (idx-1)%3;
                buf[i][b*3 + (idx + 1)%3] = buf[i-3][idx];
            }
        }
    }

    for (int i = 0; i < 9; ++i) {
        cout << buf[i] << endl;
    }
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
592836471

correct output
592836471
836471592
471592836
928364715
364715928
...

user output
592836471
836471592
471592836
259683147
683147259
...

Test 2

Verdict: ACCEPTED

input
672935418

correct output
672935418
935418672
418672935
729354186
354186729
...

user output
672935418
935418672
418672935
267593841
593841267
...

Test 3

Verdict: ACCEPTED

input
329174658

correct output
329174658
174658329
658329174
291746583
746583291
...

user output
329174658
174658329
658329174
932417865
417865932
...

Test 4

Verdict: ACCEPTED

input
376958421

correct output
376958421
958421376
421376958
769584213
584213769
...

user output
376958421
958421376
421376958
637895142
895142637
...

Test 5

Verdict: ACCEPTED

input
875694321

correct output
875694321
694321875
321875694
756943218
943218756
...

user output
875694321
694321875
321875694
587469132
469132587
...