Where is my mistake in june20 question even matrix?

problem link:

my solution link :sweat_smile:
https://www.codechef.com/viewsolution/48352082

help me out :slight_smile:

1 Like

First of all correct the problem link .
Now your code fails even on sample test case , do remember that the value of elements should be from 1 to N^2 , and all of them should be distinct .

1 Like

now , sir ?? i corrected the link

Try reading the editorial , as it is failing for every odd value of N .

1 Like

Sir, after taking 1 3 as a test case.It is showing 1 2 3 4 5 6 7 8 9 as it is satisfied the condition. Example :1+5=6,2+4=6,5+9=14.

Ohhh Sorry , I wanted to write for every even value of N it is failing . No need to write Sir , I am still a young boy .

1 Like

After taking 1 4 as test case , it is showing
Photo given below

The code in the link shows this as

Output

1 3 5 7

10 12 14 16

17 19 21 23

26 28 30 32

For 1 4 input
1 Like

thank you so muchโ€ฆ :smiling_face_with_three_hearts: i got itโ€ฆ

1 Like

You last else statement doesnโ€™t have an opening ({) and closing curly brace (})