結果

問題 No.2999 Long Long Friedrice
ユーザー rlangevin
提出日時 2025-01-11 14:55:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 2,445 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 71,296 KB
最終ジャッジ日時 2025-01-11 14:55:57
合計ジャッジ時間 5,650 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = []
for a, b in zip(A, B):
    D.append((a, a + b))
    
D.sort()
M = 10 ** 6 + 5
dp = [0] * M
dp[1] = 1
for a, b in D:
    if not dp[a]:
        continue
    dp[b] = 1
    
for i in range(M - 1, 0, -1):
    if dp[i]:
        print(i)
        exit()
0