Task: | Ruudukko |
Sender: | JuhoS |
Submission time: | 2019-10-03 11:32:13 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.06 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &size); ~~~~~^~~~~~~~~~~~~
Code
#include <stdio.h> #include <stdlib.h> int main(void) { int size; scanf("%d", &size); int list[size][size]; int i, j; int b = 0; for(i = 0; i < size; i++) { for(j = 0; j < size; j++) { for(int l = 1;; l++) { b = 1; for(int k = i; k > 0; k--) { if (list[i-k][j] == l) b = 0; } for(int k = j; k > 0; k--) { if (list[i][j-k] == l) b = 0; } if(b==1) { b = 0; list[i][j]=l; break; } } } } for(i = 0; i < size; i++) { for(j = 0; j < size; j++) { printf("%d ", list[i][j]); } printf("\n"); } }
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 |