結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー tamatotamato
提出日時 2019-12-12 15:29:05
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,196 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 86,564 KB
実行使用メモリ 579,712 KB
最終ジャッジ日時 2023-09-07 07:37:24
合計ジャッジ時間 26,533 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,224 KB
testcase_01 AC 73 ms
71,292 KB
testcase_02 AC 72 ms
71,156 KB
testcase_03 AC 74 ms
71,256 KB
testcase_04 AC 77 ms
74,984 KB
testcase_05 AC 82 ms
75,428 KB
testcase_06 AC 81 ms
75,472 KB
testcase_07 AC 83 ms
75,536 KB
testcase_08 AC 103 ms
78,380 KB
testcase_09 AC 89 ms
76,408 KB
testcase_10 AC 90 ms
76,272 KB
testcase_11 AC 1,018 ms
394,852 KB
testcase_12 AC 902 ms
427,336 KB
testcase_13 AC 714 ms
388,996 KB
testcase_14 AC 180 ms
125,744 KB
testcase_15 AC 1,022 ms
340,036 KB
testcase_16 MLE -
testcase_17 AC 342 ms
139,064 KB
testcase_18 MLE -
testcase_19 AC 1,375 ms
430,164 KB
testcase_20 AC 331 ms
185,460 KB
testcase_21 AC 156 ms
102,700 KB
testcase_22 AC 236 ms
150,640 KB
testcase_23 AC 97 ms
79,560 KB
testcase_24 AC 612 ms
392,560 KB
testcase_25 MLE -
testcase_26 MLE -
testcase_27 TLE -
testcase_28 MLE -
testcase_29 MLE -
testcase_30 AC 1,072 ms
500,920 KB
testcase_31 MLE -
testcase_32 MLE -
権限があれば一括ダウンロードができます

ソースコード

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)]
        seen[0][0] = 1
        flg = 0
        while st:
            i, j = st.pop()
            if i+j == mid:
                flg = 1
                break
            if i+1 <= N:
                if seen[i+1][j] == 0:
                    seen[i + 1][j] = 1
                    if grid[i+1][j] >= d[-(i+j+1)]:
                        st.append((i+1, j))
            if j+1 <= N:
                if seen[i][j+1] == 0:
                    seen[i][j + 1] = 1
                    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