Task: | Sudoku |
Sender: | |
Submission time: | 2015-08-15 10:51:26 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.14 s | details |
#2 | RUNTIME ERROR | 0.14 s | details |
#3 | RUNTIME ERROR | 0.15 s | details |
#4 | RUNTIME ERROR | 0.14 s | details |
#5 | RUNTIME ERROR | 0.14 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:24:18: warning: iteration 8u invokes undefined behavior [-Waggressive-loop-optimizations] rivi[i] = r[i] - '0'; // convertoidaan numeroksi ^ input/code.cpp:22:3: note: containing loop for (int i = 0; i < 9; i++) ^ input/code.cpp:29:24: warning: iteration 8u invokes undefined behavior [-Waggressive-loop-optimizations] std::cout << rivi[i]; ^ input/code.cpp:27:3: note: containing loop for (int i = 0; i < 9; i++) ^
Code
// sudoku #include <iostream> // toteutus ei ole optimaalinen int rivi[8]; int l(int i) { while(i > 9) i -= 9; // purkka jolla estetaan bugi, jossa 1 sijasta tulee aina nolla if (rivi[i] == 0) return 1; return rivi[i]; } int main() { // luetaan rivi char r[8]; std::cin >> r[0] >> r[1] >> r[2] >> r[3] >> r[4] >> r[5] >> r[6] >> r[7] >> r[8]; for (int i = 0; i < 9; i++) { rivi[i] = r[i] - '0'; // convertoidaan numeroksi } for (int i = 0; i < 9; i++) { std::cout << rivi[i]; } // kaydaan kaikki rivit lapi int plus = 3; int i = 0; while (i < 9) { i++; if (i % 3 == 0) plus++; std::cout << std::endl; for (int n = 0; n < 9; n++) { //ruudukko[i][n] = l(n + 3 + plus); std::cout << l(n + plus); } plus += 3; } std::cout << std::endl; // rivinvaihto }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
592836471 |
correct output |
---|
592836471 836471592 471592836 928364715 364715928 ... |
user output |
---|
592836471 836471192 471192836 928364711 364711928 ... |
Error:
*** stack smashing detected ***: input/code terminated
Test 2
Verdict: RUNTIME ERROR
input |
---|
672935418 |
correct output |
---|
672935418 935418672 418672935 729354186 354186729 ... |
user output |
---|
672935418 935418172 418172935 729354181 354181729 ... |
Error:
*** stack smashing detected ***: input/code terminated
Test 3
Verdict: RUNTIME ERROR
input |
---|
329174658 |
correct output |
---|
329174658 174658329 658329174 291746583 746583291 ... |
user output |
---|
329174658 174658129 658129174 291746581 746581291 ... |
Error:
*** stack smashing detected ***: input/code terminated
Test 4
Verdict: RUNTIME ERROR
input |
---|
376958421 |
correct output |
---|
376958421 958421376 421376958 769584213 584213769 ... |
user output |
---|
376958421 958421176 421176958 769584211 584211769 ... |
Error:
*** stack smashing detected ***: input/code terminated
Test 5
Verdict: RUNTIME ERROR
input |
---|
875694321 |
correct output |
---|
875694321 694321875 321875694 756943218 943218756 ... |
user output |
---|
875694321 694321175 321175694 756943211 943211756 ... |
Error:
*** stack smashing detected ***: input/code terminated