結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2022-05-16 18:27:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 668 bytes |
| コンパイル時間 | 428 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,676 KB |
| 最終ジャッジ日時 | 2024-09-14 11:03:30 |
| 合計ジャッジ時間 | 11,238 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
from bisect import bisect_left,bisect_right
import sys
readline=sys.stdin.readline
N=int(readline())
D=list(map(int,readline().split()))
D.sort()
x,y=map(int,readline().split())
ans=3
if abs(x)+abs(y) in D:
ans=1
for d in D:
l,r=-d,d
for a in (-d,d):
for xx,yy in ((x,y),(y,x)):
if l<=xx<=r:
m=0
M=max(abs(r-xx),abs(xx-l))
else:
m=min(abs(r-xx),abs(xx-l))
M=max(abs(r-xx),abs(xx-l))
m=max(m,abs(a-yy))
M=max(M,abs(a-yy))
if bisect_right(D,M)-bisect_left(D,m):
ans=min(ans,2)
if ans==3:
ans=-1
print(ans)
vwxyz