結果

問題 No.602 隠されていたゲーム2
ユーザー vwxyzvwxyz
提出日時 2022-05-16 18:27:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 19,236 KB
最終ジャッジ日時 2023-10-12 12:08:47
合計ジャッジ時間 10,293 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,048 KB
testcase_01 AC 16 ms
8,116 KB
testcase_02 AC 16 ms
8,072 KB
testcase_03 WA -
testcase_04 AC 16 ms
7,996 KB
testcase_05 AC 16 ms
8,116 KB
testcase_06 AC 16 ms
8,048 KB
testcase_07 WA -
testcase_08 AC 16 ms
8,032 KB
testcase_09 AC 16 ms
8,000 KB
testcase_10 AC 16 ms
8,000 KB
testcase_11 AC 16 ms
8,116 KB
testcase_12 AC 16 ms
8,048 KB
testcase_13 AC 16 ms
8,144 KB
testcase_14 AC 16 ms
7,996 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 386 ms
11,528 KB
testcase_18 AC 1,095 ms
16,820 KB
testcase_19 AC 1,286 ms
19,116 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,476 ms
19,016 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0