結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 19:57:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 2,660 ms
コンパイル使用メモリ 81,344 KB
実行使用メモリ 217,372 KB
最終ジャッジ日時 2023-10-17 08:27:41
合計ジャッジ時間 22,905 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,224 KB
testcase_01 AC 39 ms
53,224 KB
testcase_02 AC 38 ms
53,224 KB
testcase_03 AC 40 ms
53,224 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1,066 ms
170,804 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 740 ms
144,820 KB
testcase_16 AC 1,276 ms
201,972 KB
testcase_17 AC 218 ms
87,456 KB
testcase_18 AC 1,369 ms
203,476 KB
testcase_19 AC 1,141 ms
176,296 KB
testcase_20 AC 303 ms
96,720 KB
testcase_21 AC 142 ms
84,192 KB
testcase_22 AC 273 ms
91,664 KB
testcase_23 AC 81 ms
76,400 KB
testcase_24 AC 765 ms
138,756 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1,372 ms
210,724 KB
testcase_28 AC 1,391 ms
204,812 KB
testcase_29 AC 1,538 ms
217,272 KB
testcase_30 AC 1,540 ms
217,292 KB
testcase_31 AC 971 ms
215,020 KB
testcase_32 AC 1,471 ms
217,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
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()
L = [[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]
        L[i][j] = bisect.bisect_right(D, c) - 1

dp = [[N]*(N+1) for _ in range(N+1)]
for i in range(N):
    for j in range(N):
        if i+j >= N:
            continue
        dp[i+1][j] = min(L[i+1][j], dp[i][j]-1)
        dp[i][j+1] = min(L[i][j+1], dp[i][j]-1)

ans = 0
for i in range(N+1):
    for j in range(N+1):
        if dp[i][j] < 0 or i+j > N:
            continue
        ans = max(ans, i+j)

print(ans)
0