結果
問題 |
No.602 隠されていたゲーム2
|
ユーザー |
|
提出日時 | 2017-12-02 22:37:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 105 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 32,260 KB |
最終ジャッジ日時 | 2024-11-28 03:50:32 |
合計ジャッジ時間 | 22,600 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 8 TLE * 7 |
ソースコード
import sys from itertools import combinations readline = sys.stdin.readline n = int(readline()) d = sorted(map(int, readline().split())) x, y = map(int, readline().split()) max_xy = abs(x) + abs(y) def solve(): if max_xy in d: return 1 if len(d) == 1: return -1 if max_xy > d[-1] + d[-2]: return -1 for a, b in combinations(d, 2): if max_xy == a + b or max_xy == abs(a - b): return 2 return -1 print(solve())