結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー 👑 tamatotamato
提出日時 2019-12-12 15:20:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,003 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 81,200 KB
最終ジャッジ日時 2023-09-07 07:25:45
合計ジャッジ時間 5,059 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,596 KB
testcase_01 AC 70 ms
71,168 KB
testcase_02 AC 70 ms
71,048 KB
testcase_03 AC 71 ms
71,340 KB
testcase_04 AC 80 ms
74,940 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 #

def main():
    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)


if __name__ == '__main__':
    main()
0