結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー titiatitia
提出日時 2019-12-12 11:46:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 2,898 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 148,976 KB
最終ジャッジ日時 2023-09-07 02:56:45
合計ジャッジ時間 10,260 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,104 KB
testcase_01 AC 69 ms
71,304 KB
testcase_02 AC 70 ms
71,276 KB
testcase_03 AC 70 ms
71,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 297 ms
112,136 KB
testcase_16 AC 456 ms
141,752 KB
testcase_17 AC 127 ms
85,868 KB
testcase_18 AC 441 ms
135,388 KB
testcase_19 AC 389 ms
128,160 KB
testcase_20 AC 161 ms
88,520 KB
testcase_21 AC 123 ms
81,856 KB
testcase_22 AC 147 ms
86,624 KB
testcase_23 AC 79 ms
76,224 KB
testcase_24 AC 280 ms
112,516 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 493 ms
148,376 KB
testcase_28 AC 451 ms
134,944 KB
testcase_29 WA -
testcase_30 AC 406 ms
148,756 KB
testcase_31 AC 259 ms
134,812 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

DP=[[-1]*(N+1) for i in range(N+1)]
DP[0][0]=0

for s in range(N):
    for i in range(s+1):
        now=DP[i][s-i]
        if now==-1:
            continue

        next1=A[i+1]+B[s-i]

        for j in range(now,N):
            if next1>=D[j]:
                DP[i+1][s-i]=max(j+1,DP[i+1][s-i])
                break

        next2=A[i]+B[s-i+1]

        for j in range(now,N):
            if next2>=D[j]:
                DP[i][s-i+1]=max(j+1,DP[i][s-i+1])
                break

ANS=0
for i in range(N+1):
    for j in range(N+1):
        if DP[i][j]!=-1:
            ANS=max(ANS,i+j)
print(ANS)
0