結果

問題 No.2999 Long Long Friedrice
ユーザー titia
提出日時 2024-12-24 02:34:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 756 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 89,344 KB
最終ジャッジ日時 2024-12-24 02:35:17
合計ジャッジ時間 28,376 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

E=[[] for i in range(10**6+2)]

for i in range(N):
    E[A[i]].append(A[i]+B[i])

USE=[0]*(10**6+2)

Q=[1]
USE[1]=1

while Q:
    x=Q.pop()

    for to in E[x]:
        if USE[to]==0:
            USE[to]=1
            Q.append(to)

ANS=0

for i in range(10**6+2):
    if USE[i]==1:
        ANS=i

print(ANS)
0