結果
| 問題 | No.1083 余りの余り |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-19 23:00:49 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 3,000 ms |
| + 921µs | |
| コード長 | 684 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,984 KB |
| 実行使用メモリ | 84,480 KB |
| 最終ジャッジ日時 | 2026-08-05 04:16:52 |
| 合計ジャッジ時間 | 4,855 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
nax = 0
from collections import deque
import bisect
for i in range(n):
u = a[:i]
crt = k % a[i]
# print(a[i], crt)
for j in range(n):
if crt < a[j]:
u = a[:j]
break
# print(u)
q = deque([])
q.append((crt, u))
while q:
now = q.popleft()
if not now[1]:
nax = max(nax, now[0])
else:
for j in range(len(now[1])):
crt = now[0] % now[1][j]
t = bisect.bisect_right(now[1], crt)
q.append((crt, now[1][:t]))
# print(q)
# print(nax)
print(nax)