結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 19:51:25
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 842 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 846,972 KB
最終ジャッジ日時 2023-10-17 08:26:59
合計ジャッジ時間 7,617 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,540 KB
testcase_01 AC 43 ms
55,540 KB
testcase_02 AC 44 ms
55,540 KB
testcase_03 AC 43 ms
55,540 KB
testcase_04 MLE -
testcase_05 MLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
from collections import deque
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
D = [int(d) for d in input().split()]

D.sort()
dp = [[N]*(N+1) for _ in range(N+1)]
for i in range(N+1):
    for j in range(N+1):
        if i+j > N:
            continue
        c = A[i] + B[j]
        dp[i][j] = bisect.bisect_right(D, c) - 1

ans = 0
q = deque()
q.append((0, 0, N))
while q:
    temp = q.popleft()
    i = temp[0]
    j = temp[1]
    cnt = temp[2]
    ans = max(ans, i+j)
    if i+j == N:
        continue
    if 0 < dp[i+1][j] < cnt:
        q.append((i+1, j, dp[i+1][j]))
    elif dp[i+1][j] >= cnt > 0:
        q.append((i+1, j, cnt-1))
    if 0 < dp[i][j+1] < cnt:
        q.append((i, j+1, dp[i][j+1]))
    elif dp[i][j+1] >= cnt > 0:
        q.append((i, j+1, cnt-1))

print(ans)
0