結果

問題 No.602 隠されていたゲーム2
ユーザー yumechi
提出日時 2017-12-02 00:24:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 105,088 KB
最終ジャッジ日時 2024-11-28 01:32:24
合計ジャッジ時間 2,921 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    dl = dict(zip([int(i) for i in input().split()], [0]*n))
    x, y = map(int, input().split())
    goal = abs(x) + abs(y)
    
    if goal == 0:
        print(0)
        return

    if goal in dl:
        print(1)
        return

    for d in dl.keys():
        tg = abs(goal - d)
        if tg in dl:
            print(2)
            return
    print(-1)

if __name__=='__main__':
    solve()
0