結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー 👑 tamatotamato
提出日時 2019-12-12 15:18:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 817 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 86,152 KB
実行使用メモリ 80,996 KB
最終ジャッジ日時 2023-09-07 07:23:15
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,484 KB
testcase_01 AC 71 ms
71,112 KB
testcase_02 AC 71 ms
70,944 KB
testcase_03 AC 71 ms
70,804 KB
testcase_04 AC 75 ms
75,068 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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 #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = list(map(int, input().split()))

grid = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(N+1):
    for j in range(N+1):
        grid[i][j] = A[i] + B[j]
D.sort()
ok = 0
ng = N+1
mid = (ok + ng) // 2
while ng - ok > 1:
    d = D[:mid]
    seen = [[0 for _ in range(N+1)] for _ in range(N+1)]
    st = [(0, 0)]
    flg = 0
    while st:
        i, j = st.pop()
        if i+j == mid:
            flg = 1
            break
        if i+1 <= N:
            if grid[i+1][j] >= d[-(i+j+1)]:
                st.append((i+1, j))
        if j+1 <= N:
            if grid[i][j+1] >= d[-(i+j+1)]:
                st.append((i, j+1))
    if flg:
        ok = mid
    else:
        ng = mid
    mid = (ok+ng)//2

print(ok)


0