結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-02 02:19:40 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 635 bytes |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 34,508 KB |
| 最終ジャッジ日時 | 2024-11-28 02:20:48 |
| 合計ジャッジ時間 | 19,721 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 11 RE * 1 TLE * 6 |
ソースコード
from bisect import bisect
def main():
N = int(input())
D = tuple(map(int, input().split()))
X, Y = map(int, input().split())
p = abs(X) + abs(Y)
if p == 0:
print(0)
elif N == 1:
if p % D[0]:
print(-1)
else:
print(p // D[0])
return
div_ = []
mod_ = []
apndd = div_.append
apndm = mod_.append
for i in D:
d, m = divmod(max(p, i), min(p, i))
apndd(d)
apndm(m)
num = []
apnd = num.append
for i, j in zip(div_, mod_):
if j == 0 or j in D:
apnd(i)
print(min(num) + 1)
main()