Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • \$\begingroup\$ How slow is it? \$\endgroup\$ Commented Jan 9, 2016 at 12:31
  • \$\begingroup\$ @Loovjo tried on my PC with some small changes to make it faster, 15ms for n=5, 12 sec for n=6 (input +1, time * 800)! \$\endgroup\$ Commented Jan 9, 2016 at 14:26
  • \$\begingroup\$ @edc65 That was my experience. Anything greater than 5 the performance was dramatically slower. I didn't bother with trying inputs greater than 6. \$\endgroup\$ Commented Jan 9, 2016 at 14:50
  • \$\begingroup\$ I started with 7 when I posted my comment. We'll see \$\endgroup\$ Commented Jan 9, 2016 at 14:53
  • \$\begingroup\$ You can squeeze out a few more chars with #define d(x,y)b[x]*b[x+y]*b[x+y+y]; by changing the start of s to s(i,m){for(m=n-2; and replacing all instances of n-2; and by changing b[x]++ to b[x++]++ and then replacing x==n*n-1 with x==n*n, x+1 with x, and x with x-1. \$\endgroup\$ Commented Jan 16, 2016 at 22:33