結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー O2MTO2MT
提出日時 2021-02-11 18:01:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 867 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 362,028 KB
最終ジャッジ日時 2023-09-25 07:47:26
合計ジャッジ時間 34,991 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,492 KB
testcase_01 AC 71 ms
71,432 KB
testcase_02 AC 73 ms
71,496 KB
testcase_03 AC 72 ms
71,388 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 TLE -
testcase_17 AC 230 ms
105,856 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 92 ms
76,416 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
D = list(map(int,input().split()))
D.sort(reverse = True)
M = len(D)
left = 0
right = N+1

def doDP(num):
    dp = [[False for _ in range(N+1)] for _ in range(N+1)]
    count = 0
    for i in range(1,num+1):
        if A[i]+B[0] >= D[i-1]:
            dp[i][0] = True
        else:
            break
    for j in range(1,num+1):
        if A[0]+B[j] >= D[j-1]:
            dp[0][j] = True
        else:
            break
    for i in range(N):
        for j in range(N-i):
            if (D[i+j-1] <= A[i]+B[j]) and (dp[i-1][j] or dp[i][j-1]):
                dp[i][j] = True
                count = max(count,i+j+1)
    return count

while (right-left) > 1:
    mid = (right+left)//2
    c = doDP(mid)
    if left < c:
        left = mid
    else:
        right = mid
print(left)
0