結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあん
提出日時 2019-12-06 06:43:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 734 ms / 2,500 ms
コード長 441 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 77,348 KB
最終ジャッジ日時 2024-06-24 02:38:13
合計ジャッジ時間 8,923 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

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()

ok = 0
ng = n + 1
while ng - ok > 1:
    m = (ok + ng) // 2
    f = [ True ]
    for i in range(1, m + 1):
        f = [ a[j] + b[i - j] >= d[m - i] and (j < i and f[j] or j > 0 and f[j - 1]) for j in range(i + 1) ]

    if any(f):
        ok = m
    else:
        ng = m

print(ok)
0