CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:sk3
Submission time:2019-10-02 23:07:56 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#20.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.06 sdetails
#60.06 sdetails

Code

#include <iostream>
using namespace std;
int main(){
int in;
cin >> in;
int test, out[in][in];
bool pass;
for (int y=0; y<in; y++){
for (int x=0; x<in; x++){
test = 1;
while(true){
pass = true;
for (int tx = x; tx >= 0; tx--){
if (out[tx][y] == test) {pass=false;}
}
for (int ty = y; ty >= 0; ty--){
if (out[x][ty] == test) {pass=false;}
}
if (pass == true){break;} else {test++;}
}
out[x][y] = test;
}
}
for (int y=0; y<in; y++){
for (int x=0; x<in; x++){
cout << out[x][y];
}
cout << endl;
}
return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output

user output
1

Test 2

Verdict:

input
2

correct output
1 2 
2 1 

user output
12
21

Test 3

Verdict:

input
5

correct output
1 2 3 4 5 
2 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

user output
12345
21436
34127
43218
56781

Test 4

Verdict:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
123456789101112131415161718192...
Truncated

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
123456789101112131415161718192...
Truncated

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
123456789101112131415161718192...
Truncated