結果

問題 No.1083 余りの余り
ユーザー roarisroaris
提出日時 2020-06-20 01:06:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 442 ms / 3,000 ms
コード長 343 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 77,368 KB
最終ジャッジ日時 2023-09-16 16:23:52
合計ジャッジ時間 6,755 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,424 KB
testcase_01 AC 67 ms
71,284 KB
testcase_02 AC 74 ms
76,676 KB
testcase_03 AC 66 ms
71,416 KB
testcase_04 AC 79 ms
76,604 KB
testcase_05 AC 165 ms
77,080 KB
testcase_06 AC 66 ms
71,356 KB
testcase_07 AC 74 ms
76,400 KB
testcase_08 AC 75 ms
76,776 KB
testcase_09 AC 70 ms
71,284 KB
testcase_10 AC 74 ms
76,716 KB
testcase_11 AC 74 ms
76,668 KB
testcase_12 AC 69 ms
71,240 KB
testcase_13 AC 66 ms
71,364 KB
testcase_14 AC 68 ms
71,264 KB
testcase_15 AC 68 ms
71,428 KB
testcase_16 AC 67 ms
71,316 KB
testcase_17 AC 68 ms
71,360 KB
testcase_18 AC 255 ms
77,308 KB
testcase_19 AC 166 ms
77,040 KB
testcase_20 AC 81 ms
76,700 KB
testcase_21 AC 88 ms
76,880 KB
testcase_22 AC 70 ms
71,264 KB
testcase_23 AC 442 ms
77,320 KB
testcase_24 AC 438 ms
77,172 KB
testcase_25 AC 434 ms
77,260 KB
testcase_26 AC 441 ms
77,200 KB
testcase_27 AC 76 ms
76,700 KB
testcase_28 AC 437 ms
77,368 KB
testcase_29 AC 72 ms
71,316 KB
testcase_30 AC 67 ms
71,288 KB
testcase_31 AC 67 ms
71,428 KB
testcase_32 AC 69 ms
71,636 KB
testcase_33 AC 434 ms
77,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0

for S in range(1, 1<<N):
    now = K
    right = -1
    
    for i in range(N):
        if (S>>i)&1:
            now %= A[i]
            right = i
    
    for i in range(right+1, N):
        now %= A[i]
    
    ans = max(ans, now)

print(ans)
0