Task: | Ruudukko |
Sender: | antti_p |
Submission time: | 2019-10-08 10:09:45 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'void ruudukko()': input/code.cpp:29:14: warning: 'min' may be used uninitialized in this function [-Wmaybe-uninitialized] std::cout << min; ~~~~~~~~~~^~~~~~
Code
#include <iostream> void ruudukko() { int input; std::cin >> input; int* matrix = new int[input*input]; bool* included = new bool[2*input]; for (int r = 0; r < input; ++r) { for (int c = 0; c < input; ++c) { for (int i = 0; i < 2*input; ++i) { included[i] = false; } for (int top = 0; top < r; ++top) { included[matrix[top*input + c] - 1] = true; } for (int left = 0; left < c; ++left) { //std::cout << "Iter: |" << matrix[r*input + left] << "| "; included[matrix[r*input + left] - 1] = true; } int min; for (int i = 0; i < 2*input; ++i) { //std::cout << "in[" << i << "] = " << included[i]; if (!included[i]) { min = i + 1; break; } } matrix[r*input + c] = min; std::cout << min; } std::cout << "\n"; } delete[] matrix; delete[] included; } int main() { ruudukko(); return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 |
correct output |
---|
1 2 2 1 |
user output |
---|
12 21 |
Test 3
Verdict: WRONG ANSWER
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: WRONG ANSWER
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
123456789101112131415161718192... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
99 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
123456789101112131415161718192... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
100 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
123456789101112131415161718192... Truncated |