結果

問題 No.1083 余りの余り
ユーザー buey_tbuey_t
提出日時 2023-03-18 18:07:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 618 ms / 3,000 ms
コード長 1,604 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 89,348 KB
最終ジャッジ日時 2023-10-18 17:26:36
合計ジャッジ時間 10,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
84,540 KB
testcase_01 AC 131 ms
84,536 KB
testcase_02 AC 157 ms
89,244 KB
testcase_03 AC 177 ms
84,536 KB
testcase_04 AC 153 ms
89,300 KB
testcase_05 AC 231 ms
89,312 KB
testcase_06 AC 131 ms
84,540 KB
testcase_07 AC 150 ms
89,276 KB
testcase_08 AC 147 ms
89,244 KB
testcase_09 AC 132 ms
84,540 KB
testcase_10 AC 152 ms
89,244 KB
testcase_11 AC 153 ms
89,272 KB
testcase_12 AC 133 ms
84,536 KB
testcase_13 AC 133 ms
84,548 KB
testcase_14 AC 132 ms
84,544 KB
testcase_15 AC 131 ms
84,308 KB
testcase_16 AC 133 ms
84,544 KB
testcase_17 AC 131 ms
84,544 KB
testcase_18 AC 315 ms
89,304 KB
testcase_19 AC 228 ms
89,312 KB
testcase_20 AC 151 ms
89,272 KB
testcase_21 AC 157 ms
89,276 KB
testcase_22 AC 133 ms
84,544 KB
testcase_23 AC 611 ms
89,340 KB
testcase_24 AC 618 ms
89,340 KB
testcase_25 AC 610 ms
89,344 KB
testcase_26 AC 614 ms
89,344 KB
testcase_27 AC 148 ms
89,252 KB
testcase_28 AC 610 ms
89,348 KB
testcase_29 AC 133 ms
84,540 KB
testcase_30 AC 133 ms
84,544 KB
testcase_31 AC 131 ms
84,544 KB
testcase_32 AC 130 ms
84,544 KB
testcase_33 AC 606 ms
89,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    try:
        import pypyjit
        pypyjit.set_param('max_unroll_recursion=-1')
    except:
        pass
    try:
        import sys
        sys.setrecursionlimit(10**7)
    except:
        pass
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    
    '''
    まあ余りが-1になればよいんだよな
    降順ソートして全探索か
    えぐいな
    
    
    '''
    
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    
    A.sort(reverse=True)
    ans = 0
    
    for i in range(2**N):
        now = K
        for j in range(N):
            if (i>>j)&1:
                now %= A[j]
        now %= A[-1]
        ans = max(ans, now)
    
    print(ans)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0