結果
| 問題 | No.2767 Add to Divide |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-24 09:58:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 482 bytes |
| コンパイル時間 | 372 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-06-24 09:58:26 |
| 合計ジャッジ時間 | 6,037 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 WA * 4 |
ソースコード
import bisect
def divisors(n):
lower, upper = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower.append(i)
if i != n // i:
upper.append(n//i)
i += 1
return lower + upper[::-1]
t = int(input())
for i in range(t):
a, b = map(int, input().split())
ba = b - a
ans = divisors(ba)
j = bisect.bisect_left(ans, a)
if len(ans[j:]) == 0:
print(-1)
else:
print(min(ans[j:]) - a)