Submission #852812

#TimeUsernameProblemLanguageResultExecution timeMemory
852812iamjiamingliuA Huge Tower (CEOI10_tower)Cpython 3
0 / 100
1053 ms262148 KiB
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)): if subset.bit_count() == 1: continue 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...