結果

問題 No.1083 余りの余り
ユーザー kohei2019kohei2019
提出日時 2022-07-25 23:36:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 3,000 ms
コード長 375 bytes
コンパイル時間 1,743 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 77,232 KB
最終ジャッジ日時 2023-09-22 10:28:04
合計ジャッジ時間 5,733 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,300 KB
testcase_01 AC 69 ms
71,104 KB
testcase_02 AC 70 ms
71,484 KB
testcase_03 AC 71 ms
71,484 KB
testcase_04 AC 119 ms
76,544 KB
testcase_05 AC 136 ms
77,084 KB
testcase_06 AC 69 ms
71,016 KB
testcase_07 AC 74 ms
76,324 KB
testcase_08 AC 75 ms
71,416 KB
testcase_09 AC 70 ms
71,456 KB
testcase_10 AC 70 ms
71,296 KB
testcase_11 AC 74 ms
76,096 KB
testcase_12 AC 70 ms
71,448 KB
testcase_13 AC 70 ms
71,356 KB
testcase_14 AC 70 ms
71,260 KB
testcase_15 AC 69 ms
71,352 KB
testcase_16 AC 69 ms
71,496 KB
testcase_17 AC 68 ms
71,400 KB
testcase_18 AC 192 ms
77,044 KB
testcase_19 AC 135 ms
77,184 KB
testcase_20 AC 80 ms
76,684 KB
testcase_21 AC 87 ms
76,652 KB
testcase_22 AC 70 ms
71,336 KB
testcase_23 AC 304 ms
77,088 KB
testcase_24 AC 304 ms
77,168 KB
testcase_25 AC 307 ms
77,088 KB
testcase_26 AC 309 ms
77,092 KB
testcase_27 AC 70 ms
71,148 KB
testcase_28 AC 308 ms
77,232 KB
testcase_29 AC 70 ms
71,152 KB
testcase_30 AC 69 ms
71,380 KB
testcase_31 AC 70 ms
71,288 KB
testcase_32 AC 70 ms
71,500 KB
testcase_33 AC 306 ms
77,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
lsA = list(map(int,input().split()))
# bit全探索
lsA.sort(reverse=True)
minA = lsA[-1]
lsA2 = lsA[:-1]
NN = len(lsA2)

ans = 0
for i in range(2**NN):
    ll = []
    for j in range(NN):
        if (i>>j) & 1:
            ll.append(lsA2[j])
    c = K
    for j in range(len(ll)):
        c %= ll[j]
    c%=minA
    ans = max(ans,c)
print(ans)
0