Submission #315512
Source Code Expand
N,X = gets.split.map(&:to_i)
ws = []
N.times {
ws << gets.to_i
}
dp = Hash.new(0)
dp[0] = 1
ws.each {|w|
dp.keys.sort {|a,b|b<=>a}.each {|k|
dp[k+w]+=dp[k] if k+w <= X
}
}
puts dp[X]
Submission Info
| Submission Time | |
|---|---|
| Task | C - 無駄なものが嫌いな人 |
| User | hato2000 |
| Language | Ruby (1.9.3) |
| Score | 0 |
| Code Size | 201 Byte |
| Status | TLE |
| Exec Time | 2128 ms |
| Memory | 29084 KiB |
Judge Result
| Set Name | All | ||||
|---|---|---|---|---|---|
| Score / Max Score | 0 / 100 | ||||
| Status |
|
| Set Name | Test Cases |
|---|---|
| All | max_1.txt, max_2.txt, max_3.txt, max_4.txt, pair_1.txt, pair_2.txt, power2_1.txt, power2_2.txt, power2_3.txt, power2_4.txt, power2_5.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, small_1.txt, small_2.txt, small_3.txt, small_4.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| max_1.txt | AC | 51 ms | 4504 KiB |
| max_2.txt | AC | 115 ms | 5168 KiB |
| max_3.txt | AC | 47 ms | 4528 KiB |
| max_4.txt | AC | 54 ms | 4548 KiB |
| pair_1.txt | TLE | 2114 ms | 25552 KiB |
| pair_2.txt | AC | 110 ms | 5060 KiB |
| power2_1.txt | TLE | 2115 ms | 25212 KiB |
| power2_2.txt | AC | 397 ms | 7492 KiB |
| power2_3.txt | AC | 53 ms | 4552 KiB |
| power2_4.txt | AC | 50 ms | 4548 KiB |
| power2_5.txt | TLE | 2123 ms | 26360 KiB |
| random_1.txt | TLE | 2122 ms | 25992 KiB |
| random_2.txt | TLE | 2118 ms | 26368 KiB |
| random_3.txt | TLE | 2107 ms | 25052 KiB |
| random_4.txt | TLE | 2128 ms | 25976 KiB |
| random_5.txt | AC | 85 ms | 4712 KiB |
| random_6.txt | AC | 106 ms | 4808 KiB |
| random_7.txt | AC | 225 ms | 5684 KiB |
| random_8.txt | TLE | 2047 ms | 11644 KiB |
| random_9.txt | TLE | 2117 ms | 29084 KiB |
| sample_1.txt | AC | 46 ms | 4424 KiB |
| sample_2.txt | AC | 47 ms | 4396 KiB |
| sample_3.txt | AC | 75 ms | 4932 KiB |
| sample_4.txt | AC | 48 ms | 4420 KiB |
| small_1.txt | AC | 48 ms | 4468 KiB |
| small_2.txt | AC | 47 ms | 4400 KiB |
| small_3.txt | AC | 47 ms | 4420 KiB |
| small_4.txt | AC | 49 ms | 4416 KiB |