Each table row shows performance measurements for this Nuitka program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 2,098 | 1.35 | 1.35 | 11,392 | 1443 | 1% 0% 0% 0% 1% 100% 0% 0% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read meteor-contest benchmark to see what this program should do.
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed by Olof Kraigher
# modified by Tupteq
# 2to3
import sys
width = 5
height = 10
rotate = dict(E='NE', NE='NW', NW='W', W='SW', SW='SE', SE='E')
flip = dict(E='W', NE='NW', NW='NE', W='E', SW='SE', SE='SW')
move = dict(E=lambda x, y: (x+1, y),
W=lambda x, y: (x-1, y),
NE=lambda x, y: (x + (y%2), y-1),
NW=lambda x, y: (x + (y%2) - 1, y-1),
SE=lambda x, y: (x + (y%2), y+1),
SW=lambda x, y: (x + (y%2) - 1, y+1))
solutions = []
masks = 10 * [0]
valid = lambda x, y: 0 <= x < width and 0 <= y < height
zerocount = lambda mask: sum([(1<= 0):
if (masks[j] & cellMask) == cellMask:
masksAtCell[cellCounter][color].append(masks[j])
j = j-1
else:
cellMask = cellMask >> 1
cellCounter -= 1
color += 1
def solveCell(cell, board):
if to_go <= 0:
# Got enough solutions
pass
elif board == 0x3FFFFFFFFFFFF:
# Solved
addSolutions()
elif board & (1 << cell) != 0:
# Cell full
solveCell(cell-1, board)
elif cell < 0:
# Out of board
pass
else:
for color in range(10):
if masks[color] == 0:
for mask in masksAtCell[cell][color]:
if mask & board == 0:
masks[color] = mask
solveCell(cell-1, board | mask)
masks[color] = 0
def addSolutions():
global to_go
s = ''
mask = 1
for y in range(height):
for x in range(width):
for color in range(10):
if masks[color] & mask != 0:
s += str(color)
break
elif color == 9:
s += '.'
mask <<= 1
# Inverse
ns = ''
for y in range(height):
for x in range(width):
ns += s[width - x - 1 + (width - y - 1) * width]
# Finally append
solutions.append(s)
solutions.append(ns)
to_go -= 2
def printSolution(solution):
for y in range(height):
for x in range(width):
print(solution[x + y*width], end=' ')
print("")
if y % 2 == 0:
print("", end=' ')
print()
def solve(n):
global to_go
to_go = n
generateBitmasks()
solveCell(width*height - 1, 0)
solve(int(sys.argv[1]))
print("%d solutions found\n" % len(solutions))
printSolution(min(solutions))
printSolution(max(solutions))
Sun, 23 Apr 2023 09:27:35 GMT MAKE: make[1]: Vstupuje se do adresáře „/home/dundee/work/pybenchmarks/bencher/tmp/meteor/tmp“ nuitka3 --remove-output meteor.nuitka-2.nuitka Nuitka-Options:INFO: Used command line options: --remove-output meteor.nuitka-2.nuitka Nuitka-Options:WARNING: You did not specify to follow or include anything but main program. Check options and make sure that is intended. Nuitka:INFO: Starting Python compilation with Nuitka '1.5' on Python '3.10' commercial grade 'not installed'. Nuitka:INFO: Completed Python level compilation and optimization. Nuitka:INFO: Generating source code for C backend compiler. Nuitka:INFO: Running data composer tool for optimal constant value handling. Nuitka:INFO: Running C compilation via Scons. Nuitka-Scons:INFO: Backend C compiler: gcc (gcc). Nuitka-Scons:INFO: Backend linking program with 7 files (no progress information available). Nuitka-Scons:WARNING: You are not using ccache. Nuitka:INFO: Removing build directory 'meteor.nuitka-2.nuitka.build'. Nuitka:INFO: Successfully created 'meteor.nuitka-2.nuitka.bin'. cp meteor.nuitka-2.nuitka.bin meteor.nuitka-2.nuitka_run make[1]: Opouští se adresář „/home/dundee/work/pybenchmarks/bencher/tmp/meteor/tmp“ 14.66s to complete and log all make actions COMMAND LINE: ./meteor.nuitka-2.nuitka_run 2098 PROGRAM OUTPUT: 2098 solutions found 0 0 0 0 1 2 2 2 0 1 2 6 6 1 1 2 6 1 5 5 8 6 5 5 5 8 6 3 3 3 4 8 8 9 3 4 4 8 9 3 4 7 4 7 9 7 7 7 9 9 9 9 9 9 8 9 6 6 8 5 6 6 8 8 5 6 8 2 5 5 7 7 7 2 5 7 4 7 2 0 1 4 2 2 0 1 4 4 0 3 1 4 0 0 3 1 1 3 3 3