結果
問題 |
No.2999 Long Long Friedrice
|
ユーザー |
|
提出日時 | 2025-06-21 12:31:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 474 bytes |
コンパイル時間 | 453 ms |
コンパイル使用メモリ | 82,676 KB |
実行使用メモリ | 67,756 KB |
最終ジャッジ日時 | 2025-06-21 12:31:27 |
合計ジャッジ時間 | 4,465 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 24 WA * 9 |
ソースコード
from collections import deque N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) G = {1:set()} for i in range(N): a = A[i] b = B[i] if a not in G: G[a] = set() if a+b not in G[a]: G[a].add(a+b) G[a+b] = set() que = deque([1]) visited = set([1]) while que: x = que.popleft() for y in G[x]: if y not in visited: visited.add(y) que.append(y) print(max(visited))