結果

問題 No.602 隠されていたゲーム2
ユーザー gew1fw
提出日時 2025-06-12 13:20:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,328 KB
実行使用メモリ 107,024 KB
最終ジャッジ日時 2025-06-12 13:22:20
合計ジャッジ時間 2,670 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n = int(input())
d = list(map(int, input().split()))
x, y = map(int, input().split())
D = abs(x) + abs(y)

d_set = set(d)
if D in d_set:
    print(1)
else:
    d_sorted = sorted(d)
    found = False
    for d1 in d_sorted:
        lower = max(D - d1, d1 - D)
        upper = d1 + D
        left = bisect.bisect_left(d_sorted, lower)
        right = bisect.bisect_right(d_sorted, upper)
        count = right - left
        if count >= 2:
            found = True
            break
    print(2 if found else -1)
0