Task: | Ruudukko |
Sender: | sk3 |
Submission time: | 2019-10-02 23:11:05 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.07 s | details |
Code
#include <iostream> using namespace std; int main(){ int in; cin >> in; int test, out[in][in] = {0}; 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++){ if (x < in-1){cout << out[x][y] << " ";} else {cout << out[x][y];} } cout << endl; } return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
1 2 2 1 |
Test 3
Verdict: ACCEPTED
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 |
---|
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 |
Test 4
Verdict: ACCEPTED
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 5
Verdict: ACCEPTED
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 6
Verdict: ACCEPTED
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |