結果

問題 No.1083 余りの余り
ユーザー hedwig100hedwig100
提出日時 2020-06-19 22:28:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 3,000 ms
コード長 600 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 8,856 KB
最終ジャッジ日時 2023-09-16 14:44:35
合計ジャッジ時間 1,958 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,620 KB
testcase_01 AC 18 ms
8,616 KB
testcase_02 AC 19 ms
8,588 KB
testcase_03 AC 19 ms
8,580 KB
testcase_04 AC 18 ms
8,484 KB
testcase_05 AC 19 ms
8,476 KB
testcase_06 AC 18 ms
8,588 KB
testcase_07 AC 18 ms
8,624 KB
testcase_08 AC 19 ms
8,496 KB
testcase_09 AC 19 ms
8,492 KB
testcase_10 AC 18 ms
8,556 KB
testcase_11 AC 19 ms
8,492 KB
testcase_12 AC 18 ms
8,628 KB
testcase_13 AC 19 ms
8,488 KB
testcase_14 AC 18 ms
8,464 KB
testcase_15 AC 18 ms
8,476 KB
testcase_16 AC 18 ms
8,560 KB
testcase_17 AC 19 ms
8,448 KB
testcase_18 AC 19 ms
8,632 KB
testcase_19 AC 18 ms
8,444 KB
testcase_20 AC 18 ms
8,488 KB
testcase_21 AC 18 ms
8,452 KB
testcase_22 AC 19 ms
8,520 KB
testcase_23 AC 18 ms
8,588 KB
testcase_24 AC 19 ms
8,560 KB
testcase_25 AC 18 ms
8,476 KB
testcase_26 AC 18 ms
8,472 KB
testcase_27 AC 18 ms
8,484 KB
testcase_28 AC 20 ms
8,856 KB
testcase_29 AC 19 ms
8,532 KB
testcase_30 AC 18 ms
8,464 KB
testcase_31 AC 18 ms
8,468 KB
testcase_32 AC 18 ms
8,588 KB
testcase_33 AC 18 ms
8,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    A.sort(reverse = True)
    before = defaultdict(int)
    before[K] = 1
    for a in A[:-1]:
        now = defaultdict(int)
        for k in before.keys():
            now[k] = 1
            now[k%a] = 1
        before = now
    now = defaultdict(int)
    for k in before.keys():
        now[k%A[-1]] = 1
    ans = max(now.keys())
    print(ans)
if __name__ == '__main__':
    main()
0