#include <stdio.h>
#define MAX(x, y) (x > y ? x : y)
//#define MIN(x, y) (x < y ? x : y)
void f(int n)
{
int i, j, x, y;
for (j = n; j--; ) {
y = n % 2 ? n / 2 - j : j - n / 2 + 1;
for (i = n; i--; ) {
x = n % 2 ? n / 2 - i : i - n / 2;
printf("%d%c", n
* n
- MAX
(MAX
(-MAX
(-(4 * x
* x
+ x
- y
), -(4 * x
* x
+ 3 * x
+ y
)), 4 * y
* y
- y
+ x
), 4 * y
* y
- 3 * y
- x
), 9 + !i
); //printf("%d%c", n * n - MAX(MAX(MIN(4 * x * x + x - y, 4 * x * x + 3 * x + y), 4 * y * y - y + x), 4 * y * y - 3 * y - x), 9 + !i);
}
}
}
int main()
{
f(1);
f(4);
f(9);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIE1BWCh4LCB5KSAoeCA+IHkgPyB4IDogeSkKLy8jZGVmaW5lIE1JTih4LCB5KSAoeCA8IHkgPyB4IDogeSkKCnZvaWQgZihpbnQgbikKewogIGludCBpLCBqLCB4LCB5OwogIGZvciAoaiA9IG47IGotLTsgKSB7CiAgICB5ID0gbiAlIDIgPyBuIC8gMiAtIGogOiBqIC0gbiAvIDIgKyAxOwogICAgZm9yIChpID0gbjsgaS0tOyApIHsKICAgICAgeCA9IG4gJSAyID8gbiAvIDIgLSBpIDogaSAtIG4gLyAyOwogICAgICBwcmludGYoIiVkJWMiLCBuICogbiAtIE1BWChNQVgoLU1BWCgtKDQgKiB4ICogeCArIHggLSB5KSwgLSg0ICogeCAqIHggKyAzICogeCArIHkpKSwgNCAqIHkgKiB5IC0geSArIHgpLCA0ICogeSAqIHkgLSAzICogeSAtIHgpLCA5ICsgIWkpOwogICAgICAvL3ByaW50ZigiJWQlYyIsIG4gKiBuIC0gTUFYKE1BWChNSU4oNCAqIHggKiB4ICsgeCAtIHksIDQgKiB4ICogeCArIDMgKiB4ICsgeSksIDQgKiB5ICogeSAtIHkgKyB4KSwgNCAqIHkgKiB5IC0gMyAqIHkgLSB4KSwgOSArICFpKTsKICAgIH0KICB9CiAgcHV0cygiIik7Cn0KCmludCBtYWluKCkKewogIGYoMSk7CiAgZig0KTsKICBmKDkpOwogIHJldHVybiAwOwp9Cg==