Submission #852813

# Submission time Handle Problem Language Result Execution time Memory
852813 2023-09-22T18:29:49 Z iamjiamingliu A Huge Tower (CEOI10_tower) Python 3
20 / 100
1000 ms 262144 KB
import sys

_, diff = map(int, input().split())
nums = list(map(int, sys.stdin.readline().strip().split()))

dp = [[0] * len(nums) for _ in range(1 << len(nums))]
for i in range(len(nums)):
    dp[1 << i][i] = 1

for subset in range(1 << len(nums)):
    for last in range(len(nums)):
        if (1 << last) & subset:
            for prev_last in range(len(nums)):
                if (1 << prev_last) & subset and nums[last] <= nums[prev_last] + diff:
                    dp[subset][last] += dp[subset ^ (1 << last)][prev_last]

print(sum(dp[-1]))
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 126 ms 3648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 238 ms 4476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 13556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 35560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1020 ms 126624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 12512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 32832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 262144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 255932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 879 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 770 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 262144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 319 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 270 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 234 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 135 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 138 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -