Task: | Ruudukko |
Sender: | Aapeli |
Submission time: | 2019-10-08 22:30:24 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | RUNTIME ERROR | 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 'int main()': input/code.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%i",&number); ~~~~~^~~~~~~~~~~~~~
Code
// // sudoku.c // datatahti // // Created by aapo haavisto on 10/6/19. // Copyright © 2019 Aapo Haavisto. All rights reserved. // #include <stdio.h> #include <stdlib.h> int main (void){ int number; scanf("%i",&number); int* list=(int*)malloc(number*sizeof(int)); for (int e=0;e<=number;e++){ list[e]=e+1; } if (number%2==0) { for (int i=0; i<number; i++) { for (int a=0; a<number; a++){ } int*newlist=(int*)malloc(number*sizeof(int)); for (int a=0;a<number;a++){ printf("%i",list[a]); printf(" "); if ((list[a])%2==1){ if(a==number-1){ newlist[0]=list[a]; } else{ newlist[a+1]=list[a]; } } else{ if(a==0){ newlist[number-1]=list[a]; } else{ newlist[a-1]=list[a]; } } } printf("\n"); list=newlist; } } else{ for (int i=0; i<number; i++) { for (int a=0; a<number; a++){ } int*newlist=(int*)malloc(number*sizeof(int)); for (int a=0;a<number;a++){ printf("%i",list[a]); printf(" "); if(a==0){ newlist[number-1]=list[a]; } else{ newlist[a-1]=list[a]; } } printf("\n"); list=newlist; } } free(list); }
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: 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 |
---|
1 2 3 4 5 2 3 4 5 1 3 4 5 1 2 4 5 1 2 3 5 1 2 3 4 |
Test 4
Verdict: RUNTIME ERROR
input |
---|
42 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
(empty) |
Error:
code: malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0)...
Test 5
Verdict: WRONG ANSWER
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: WRONG ANSWER
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 |