結果

問題 No.783 門松計画
ユーザー convexineqconvexineq
提出日時 2021-03-16 10:11:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-04-25 10:18:09
合計ジャッジ時間 2,599 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
60,160 KB
testcase_01 AC 43 ms
60,416 KB
testcase_02 AC 44 ms
60,416 KB
testcase_03 AC 40 ms
57,728 KB
testcase_04 AC 43 ms
58,240 KB
testcase_05 AC 46 ms
60,672 KB
testcase_06 AC 44 ms
58,880 KB
testcase_07 AC 44 ms
59,008 KB
testcase_08 AC 40 ms
57,856 KB
testcase_09 AC 42 ms
59,648 KB
testcase_10 AC 85 ms
72,832 KB
testcase_11 AC 189 ms
77,568 KB
testcase_12 AC 119 ms
75,264 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 52 ms
62,976 KB
testcase_16 AC 48 ms
61,952 KB
testcase_17 AC 54 ms
65,152 KB
testcase_18 AC 41 ms
58,752 KB
testcase_19 AC 67 ms
68,864 KB
testcase_20 AC 43 ms
59,392 KB
testcase_21 AC 43 ms
59,008 KB
testcase_22 AC 44 ms
60,288 KB
testcase_23 AC 43 ms
59,776 KB
testcase_24 WA -
testcase_25 AC 58 ms
65,152 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,C = map(int,input().split())
*v, = map(int,input().split())
*w, = map(int,input().split())

N = 51
dp = [[[0]*N for _ in range(N)] for _ in range(C+1)]
for i in range(n):
    for j in range(n):
        if v[i] != v[j] and w[i]+w[j] <= C:
            dp[w[i]+w[j]][v[i]][v[j]] = v[i]+v[j]

ans = 0
for i in range(C):
    for j in range(N):
        for k in range(N):
            if dp[i][j][k] == 0: continue
            for l in range(n):
                if j == v[l]: continue
                if i+w[l] > C: continue
                if j > k < v[l] or j < k > v[l]:
                    x = dp[i][j][k] + v[l]
                    ans = max(ans,x)
                    dp[i+w[l]][k][v[l]] = x
print(ans)
0