結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:41:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 629 bytes |
| コンパイル時間 | 347 ms |
| コンパイル使用メモリ | 82,284 KB |
| 実行使用メモリ | 92,108 KB |
| 最終ジャッジ日時 | 2025-06-12 19:41:54 |
| 合計ジャッジ時間 | 2,415 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 6 |
ソースコード
import bisect
n = int(input())
d = list(map(int, input().split()))
x, y = map(int, input().split())
D = abs(x) + abs(y)
if D == 0:
print(0)
else:
sorted_d = sorted(d)
idx = bisect.bisect_left(sorted_d, D)
if idx < len(sorted_d) and sorted_d[idx] == D:
print(1)
else:
found = False
for di in sorted_d:
low = max(0, D - di)
high = di + D
left = bisect.bisect_left(sorted_d, low)
right = bisect.bisect_right(sorted_d, high)
if left < right:
found = True
break
print(2 if found else -1)
gew1fw