結果
問題 | No.332 数列をプレゼントに |
ユーザー | tktk_snsn |
提出日時 | 2022-05-18 18:01:06 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,081 bytes |
コンパイル時間 | 320 ms |
コンパイル使用メモリ | 86,844 KB |
実行使用メモリ | 836,128 KB |
最終ジャッジ日時 | 2023-10-15 02:46:40 |
合計ジャッジ時間 | 14,430 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
71,128 KB |
testcase_01 | AC | 68 ms
71,116 KB |
testcase_02 | AC | 71 ms
71,132 KB |
testcase_03 | AC | 71 ms
71,328 KB |
testcase_04 | AC | 78 ms
76,040 KB |
testcase_05 | AC | 270 ms
190,308 KB |
testcase_06 | AC | 249 ms
186,504 KB |
testcase_07 | RE | - |
testcase_08 | MLE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | AC | 207 ms
161,472 KB |
testcase_12 | AC | 196 ms
143,280 KB |
testcase_13 | AC | 198 ms
160,696 KB |
testcase_14 | AC | 237 ms
165,340 KB |
testcase_15 | AC | 100 ms
92,444 KB |
testcase_16 | AC | 76 ms
75,964 KB |
testcase_17 | WA | - |
testcase_18 | MLE | - |
testcase_19 | WA | - |
testcase_20 | AC | 113 ms
103,752 KB |
testcase_21 | AC | 83 ms
75,812 KB |
testcase_22 | AC | 104 ms
94,464 KB |
testcase_23 | RE | - |
testcase_24 | AC | 220 ms
169,720 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 203 ms
168,912 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | MLE | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
ソースコード
N, X = map(int, input().split()) A = list(map(int, input().split())) small = [] big = [] for i, a in enumerate(A): if a <= 10 ** 5: small.append(i) else: big.append(i) M = len(small) W = sum(A[i] for i in small) dp = [[0] * (W + 1) for _ in range(M + 1)] dp[0][0] = 1 for i in range(M): for j in range(W + 1 - A[small[i]]): if dp[i][j]: dp[i+1][j] = 1 dp[i+1][j + A[small[i]]] = 1 K = len(big) for S in range(1 << K): tot = 0 for i in range(K): if (S >> i) & 1: tot += A[big[i]] Y = X - tot if Y > W: continue if dp[M][Y]: ans = ["x"] * N for i in range(K): if (S >> i) & 1: ans[big[i]] = "o" p, q = M, Y for _ in range(M): if dp[p-1][Y]: p -= 1 elif dp[p-1][Y - A[small[p-1]]]: p -= 1 Y -= A[small[p]] ans[small[p]] = "o" else: assert(0) print("".join(ans)) exit() print("No")