結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 20:13:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,622 ms / 2,500 ms
コード長 767 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,464 KB
実行使用メモリ 218,172 KB
最終ジャッジ日時 2023-10-17 08:29:16
合計ジャッジ時間 23,812 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,240 KB
testcase_01 AC 39 ms
53,240 KB
testcase_02 AC 41 ms
53,240 KB
testcase_03 AC 39 ms
53,240 KB
testcase_04 AC 45 ms
58,872 KB
testcase_05 AC 64 ms
70,208 KB
testcase_06 AC 64 ms
68,088 KB
testcase_07 AC 76 ms
75,636 KB
testcase_08 AC 102 ms
76,944 KB
testcase_09 AC 88 ms
75,900 KB
testcase_10 AC 78 ms
75,704 KB
testcase_11 AC 1,125 ms
171,480 KB
testcase_12 AC 1,110 ms
177,924 KB
testcase_13 AC 1,038 ms
163,700 KB
testcase_14 AC 211 ms
88,664 KB
testcase_15 AC 788 ms
145,156 KB
testcase_16 AC 1,375 ms
202,676 KB
testcase_17 AC 218 ms
87,464 KB
testcase_18 AC 1,440 ms
203,532 KB
testcase_19 AC 1,209 ms
177,012 KB
testcase_20 AC 328 ms
96,932 KB
testcase_21 AC 157 ms
84,564 KB
testcase_22 AC 284 ms
92,288 KB
testcase_23 AC 78 ms
76,404 KB
testcase_24 AC 814 ms
138,816 KB
testcase_25 AC 1,538 ms
217,516 KB
testcase_26 AC 1,505 ms
217,532 KB
testcase_27 AC 1,476 ms
217,516 KB
testcase_28 AC 1,447 ms
204,868 KB
testcase_29 AC 1,622 ms
218,124 KB
testcase_30 AC 1,562 ms
217,480 KB
testcase_31 AC 958 ms
215,024 KB
testcase_32 AC 1,558 ms
218,172 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 = [[-1]*(N+1) for _ in range(N+1)]
dp[0][0] = N
for i in range(N):
    for j in range(N):
        if i+j >= N:
            continue
        dp[i+1][j] = max(dp[i+1][j], min(L[i+1][j], dp[i][j]) - 1)
        dp[i][j+1] = max(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