結果

問題 No.1083 余りの余り
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-25 01:00:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 246 ms / 3,000 ms
コード長 334 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-09-16 21:32:15
合計ジャッジ時間 6,910 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,144 KB
testcase_01 AC 73 ms
70,888 KB
testcase_02 AC 72 ms
71,036 KB
testcase_03 AC 73 ms
71,404 KB
testcase_04 AC 81 ms
76,424 KB
testcase_05 AC 122 ms
76,276 KB
testcase_06 AC 72 ms
71,092 KB
testcase_07 AC 80 ms
76,180 KB
testcase_08 AC 72 ms
71,404 KB
testcase_09 AC 72 ms
71,084 KB
testcase_10 AC 72 ms
71,092 KB
testcase_11 AC 78 ms
76,200 KB
testcase_12 AC 72 ms
71,436 KB
testcase_13 AC 72 ms
71,244 KB
testcase_14 AC 73 ms
71,096 KB
testcase_15 AC 73 ms
71,092 KB
testcase_16 AC 74 ms
70,876 KB
testcase_17 AC 74 ms
71,204 KB
testcase_18 AC 159 ms
76,880 KB
testcase_19 AC 123 ms
76,280 KB
testcase_20 AC 79 ms
76,428 KB
testcase_21 AC 84 ms
76,388 KB
testcase_22 AC 75 ms
71,360 KB
testcase_23 AC 245 ms
77,092 KB
testcase_24 AC 241 ms
76,884 KB
testcase_25 AC 243 ms
77,052 KB
testcase_26 AC 246 ms
76,968 KB
testcase_27 AC 74 ms
71,392 KB
testcase_28 AC 241 ms
76,848 KB
testcase_29 AC 74 ms
71,380 KB
testcase_30 AC 74 ms
71,136 KB
testcase_31 AC 74 ms
71,420 KB
testcase_32 AC 74 ms
71,092 KB
testcase_33 AC 244 ms
76,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if n == 1:
    print(k%A[0])
    exit()

A.sort(reverse=True)
min_a = A[-1]
A = A[:-1]
ans = -1
for i in range(2**(n-1)):
    temp = k
    for j in range(n-1):
        if (i >> j) & 1:
            temp %= A[j]
    temp %= min_a
    ans = max(temp, ans)
print(ans)
0