結果

問題 No.1083 余りの余り
ユーザー U SU S
提出日時 2020-06-19 23:00:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 3,000 ms
コード長 684 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 77,948 KB
最終ジャッジ日時 2023-09-16 15:12:05
合計ジャッジ時間 4,827 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,736 KB
testcase_01 AC 93 ms
71,452 KB
testcase_02 AC 93 ms
71,456 KB
testcase_03 AC 92 ms
71,532 KB
testcase_04 AC 93 ms
71,676 KB
testcase_05 AC 93 ms
71,792 KB
testcase_06 AC 92 ms
71,700 KB
testcase_07 AC 92 ms
71,544 KB
testcase_08 AC 94 ms
71,732 KB
testcase_09 AC 95 ms
71,724 KB
testcase_10 AC 95 ms
71,756 KB
testcase_11 AC 91 ms
71,772 KB
testcase_12 AC 91 ms
71,804 KB
testcase_13 AC 91 ms
71,724 KB
testcase_14 AC 91 ms
71,636 KB
testcase_15 AC 93 ms
71,724 KB
testcase_16 AC 92 ms
71,532 KB
testcase_17 AC 93 ms
71,444 KB
testcase_18 AC 96 ms
71,736 KB
testcase_19 AC 96 ms
71,568 KB
testcase_20 AC 91 ms
71,620 KB
testcase_21 AC 95 ms
71,532 KB
testcase_22 AC 92 ms
71,728 KB
testcase_23 AC 93 ms
71,612 KB
testcase_24 AC 93 ms
71,596 KB
testcase_25 AC 94 ms
71,564 KB
testcase_26 AC 94 ms
71,768 KB
testcase_27 AC 93 ms
71,616 KB
testcase_28 AC 120 ms
77,948 KB
testcase_29 AC 96 ms
71,640 KB
testcase_30 AC 94 ms
71,700 KB
testcase_31 AC 95 ms
71,628 KB
testcase_32 AC 93 ms
71,820 KB
testcase_33 AC 95 ms
71,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)

0