結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 20:11:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 217,572 KB
最終ジャッジ日時 2023-10-17 08:28:51
合計ジャッジ時間 22,639 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,420 KB
testcase_01 AC 39 ms
53,420 KB
testcase_02 AC 39 ms
53,420 KB
testcase_03 AC 40 ms
53,420 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,056 ms
171,148 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 737 ms
145,120 KB
testcase_16 AC 1,281 ms
202,288 KB
testcase_17 AC 215 ms
87,736 KB
testcase_18 AC 1,352 ms
203,780 KB
testcase_19 AC 1,139 ms
176,612 KB
testcase_20 AC 303 ms
96,940 KB
testcase_21 AC 142 ms
84,396 KB
testcase_22 AC 272 ms
91,956 KB
testcase_23 AC 78 ms
76,608 KB
testcase_24 AC 768 ms
139,052 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1,369 ms
211,052 KB
testcase_28 AC 1,391 ms
205,128 KB
testcase_29 AC 1,527 ms
217,468 KB
testcase_30 AC 1,560 ms
217,408 KB
testcase_31 AC 946 ms
215,264 KB
testcase_32 AC 1,451 ms
217,572 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)

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