結果

問題 No.1083 余りの余り
ユーザー ttrttr
提出日時 2020-06-19 22:05:46
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 664 ms / 3,000 ms
コード長 397 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 77,368 KB
最終ジャッジ日時 2023-09-16 14:26:45
合計ジャッジ時間 8,166 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,204 KB
testcase_01 AC 70 ms
71,292 KB
testcase_02 AC 71 ms
71,220 KB
testcase_03 AC 70 ms
71,164 KB
testcase_04 AC 80 ms
76,644 KB
testcase_05 AC 215 ms
77,160 KB
testcase_06 AC 69 ms
71,416 KB
testcase_07 AC 75 ms
76,260 KB
testcase_08 AC 69 ms
71,400 KB
testcase_09 AC 70 ms
71,356 KB
testcase_10 AC 70 ms
71,364 KB
testcase_11 AC 77 ms
76,448 KB
testcase_12 AC 71 ms
71,380 KB
testcase_13 AC 72 ms
71,364 KB
testcase_14 AC 70 ms
71,524 KB
testcase_15 AC 70 ms
71,384 KB
testcase_16 AC 69 ms
71,168 KB
testcase_17 AC 70 ms
71,088 KB
testcase_18 AC 352 ms
76,924 KB
testcase_19 AC 213 ms
77,128 KB
testcase_20 AC 84 ms
76,520 KB
testcase_21 AC 96 ms
77,008 KB
testcase_22 AC 70 ms
71,500 KB
testcase_23 AC 660 ms
77,200 KB
testcase_24 AC 662 ms
77,172 KB
testcase_25 AC 661 ms
76,932 KB
testcase_26 AC 664 ms
77,064 KB
testcase_27 AC 71 ms
71,348 KB
testcase_28 AC 550 ms
77,052 KB
testcase_29 AC 70 ms
71,348 KB
testcase_30 AC 71 ms
71,432 KB
testcase_31 AC 70 ms
71,352 KB
testcase_32 AC 69 ms
71,348 KB
testcase_33 AC 659 ms
77,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

s = min(A)
cnt = A.count(s)
ans = 0
for i in range(1, N+1):
    for C in itertools.combinations(A, i):
        num = K
        C = list(C)
        C.sort(reverse=True)
        for c in C:
            num %= c
        for _ in range(cnt-C.count(s)):
            num %= s
        ans = max(ans, num)

print(ans)
0