結果

問題 No.1083 余りの余り
コンテスト
ユーザー rin204
提出日時 2022-02-25 08:16:15
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 141 ms / 3,000 ms
+ 720µs
コード長 264 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 219 ms
コンパイル使用メモリ 96,360 KB
実行使用メモリ 83,584 KB
最終ジャッジ日時 2026-08-04 07:36:25
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)

ans = 0
for bit in range(1 << (n - 1)):
    x = k
    for i in range(n - 1):
        if bit >> i & 1:
            x %= A[i]
    x %= A[-1]
    ans = max(ans, x)
print(ans)
0