Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 18957

The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine, which usually means all submissions have to be tested by the host of the challenge. Alternatively, the submission can be compared to a reference program. For scoring by asymptotic time complexity, use [fastest-algorithm] instead.

3 votes

Fastest count of certain hypercubes with labeled vertices

Python + python-sat (about 1 second on my machine) import itertools from pysat.solvers import Glucose4 def count_cubes(n): clauses = [] for (x, y, z) in itertools.combinations(range(1 << n), …
user1502040's user avatar
  • 3,864
2 votes

Triangularly embed a graph on a surface

Python 3 + Google OR-Tools + NetworkX A fairly direct encoding of the problem; takes a NetworkX graph. I suspect it might be possible to do better by introducing variables for the triangles, but then …
user1502040's user avatar
  • 3,864
4 votes
Accepted

Connecting the Dots: Counting n²-gons in the n×n Grid

Python 3 + Z3, N=5 Not 100% sure if this is correct. Basically a standard SAT/SMT coding of the Hamiltonian cycle problem, with additional clauses to block intersecting diagonals and collinear segment …
user1502040's user avatar
  • 3,864
3 votes
Accepted

How many draws are there in Quarto?

C: 414298141056 draws found in about 5 2.5 minutes. Just simple depth-first search with a symmetry-aware transposition table. We use the symmetry of attributes under permutation and the 8-fold dihedra …
user1502040's user avatar
  • 3,864
9 votes

How slow is Python really? (Or how fast is your language?)

Haskell: ~2000x speedup per core Compile with 'ghc -O3 -funbox-strict-fields -threaded -fllvm', and run with '+RTS -Nk' where k is the number of cores on your machine. import Control.Parallel.Stra …
user1502040's user avatar
  • 3,864