結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあんりあん
提出日時 2019-12-05 23:10:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 689 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 12,332 KB
最終ジャッジ日時 2023-09-06 07:52:13
合計ジャッジ時間 4,836 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,332 KB
testcase_01 AC 16 ms
7,896 KB
testcase_02 AC 16 ms
7,796 KB
testcase_03 AC 16 ms
7,824 KB
testcase_04 AC 17 ms
7,824 KB
testcase_05 AC 19 ms
7,796 KB
testcase_06 AC 18 ms
7,896 KB
testcase_07 AC 34 ms
8,220 KB
testcase_08 AC 99 ms
9,024 KB
testcase_09 AC 39 ms
8,364 KB
testcase_10 AC 60 ms
8,480 KB
testcase_11 TLE -
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 #

#!/usr/bin/env pypy3

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = list(map(int, input().split()))

d.sort()

dp = [[0 for j in range(n + 1)] for i in range(n + 1)]
dp[0][0] = n + 1
ans = 0
for i in range(n + 1):
    k = n
    for j in range(n + 1):
        if i == 0 and j == 0:
            continue
        while k > 0 and d[k - 1] > a[i] + b[j]:
            k -= 1

        ma = -1
        if i > 0:
            ma = max(ma, dp[i - 1][j] - 1)
        if j > 0:
            ma = max(ma, dp[i][j - 1] - 1)

        dp[i][j] = min(k, ma)
        if dp[i][j] > 0:
            ans = max(ans, i + j)
        else:
            break

print(ans)
0