結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあんりあん
提出日時 2019-12-05 23:01:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,097 ms / 2,500 ms
コード長 679 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 78,456 KB
最終ジャッジ日時 2023-09-06 07:51:51
合計ジャッジ時間 13,780 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,300 KB
testcase_01 AC 72 ms
71,388 KB
testcase_02 AC 71 ms
71,156 KB
testcase_03 AC 72 ms
71,076 KB
testcase_04 AC 78 ms
76,284 KB
testcase_05 AC 85 ms
76,000 KB
testcase_06 AC 82 ms
75,988 KB
testcase_07 AC 90 ms
76,648 KB
testcase_08 AC 103 ms
76,952 KB
testcase_09 AC 95 ms
77,136 KB
testcase_10 AC 89 ms
76,340 KB
testcase_11 AC 768 ms
77,768 KB
testcase_12 AC 655 ms
77,652 KB
testcase_13 AC 693 ms
77,640 KB
testcase_14 AC 159 ms
77,904 KB
testcase_15 AC 389 ms
77,684 KB
testcase_16 AC 677 ms
77,724 KB
testcase_17 AC 161 ms
77,096 KB
testcase_18 AC 881 ms
78,244 KB
testcase_19 AC 388 ms
77,664 KB
testcase_20 AC 160 ms
77,440 KB
testcase_21 AC 109 ms
77,488 KB
testcase_22 AC 116 ms
77,536 KB
testcase_23 AC 76 ms
75,420 KB
testcase_24 AC 482 ms
77,292 KB
testcase_25 AC 1,097 ms
78,304 KB
testcase_26 AC 884 ms
78,004 KB
testcase_27 AC 790 ms
78,456 KB
testcase_28 AC 866 ms
77,496 KB
testcase_29 AC 519 ms
77,676 KB
testcase_30 AC 222 ms
77,660 KB
testcase_31 AC 101 ms
77,160 KB
testcase_32 AC 769 ms
78,000 KB
権限があれば一括ダウンロードができます

ソースコード

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):
        nf = [ False ] * (i + 1)
        for j in range(i):
            if not f[j]:
                continue
            if a[j] + b[i - j] >= d[m - i]:
                nf[j] = True
            if a[j + 1] + b[i - j - 1] >= d[m - i]:
                nf[j + 1] = True

        f = nf

    ff = False
    for i in f:
        if i:
            ff = True
    if ff:
        ok = m
    else:
        ng = m

print(ok)
0