結果

問題 No.1237 EXP Multiple!
ユーザー buey_tbuey_t
提出日時 2023-03-27 11:10:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,831 ms / 2,000 ms
コード長 1,483 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 81,736 KB
実行使用メモリ 122,456 KB
最終ジャッジ日時 2023-10-19 14:02:44
合計ジャッジ時間 15,086 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
84,356 KB
testcase_01 AC 199 ms
111,960 KB
testcase_02 AC 219 ms
122,436 KB
testcase_03 AC 223 ms
122,456 KB
testcase_04 AC 187 ms
121,644 KB
testcase_05 AC 173 ms
116,404 KB
testcase_06 AC 175 ms
116,408 KB
testcase_07 AC 177 ms
116,992 KB
testcase_08 AC 174 ms
116,404 KB
testcase_09 AC 175 ms
116,408 KB
testcase_10 AC 181 ms
116,992 KB
testcase_11 AC 174 ms
116,408 KB
testcase_12 AC 172 ms
116,408 KB
testcase_13 AC 1,831 ms
116,224 KB
testcase_14 AC 1,828 ms
116,256 KB
testcase_15 AC 1,813 ms
116,256 KB
testcase_16 AC 1,813 ms
116,256 KB
testcase_17 AC 1,825 ms
116,256 KB
testcase_18 AC 1,806 ms
116,256 KB
testcase_19 AC 170 ms
116,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    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
    #再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
    '''
    1 2 2 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4...
    10^9がえぐすぎるな
    草
    '''
    
    N = int(input())
    A = list(map(int, input().split()))
    
    A.sort(reverse=True)
    
    if A[0] >= 4:
        print(mod1)
    elif A[-1] == 0:
        print(-1)
    else:
        ans = 1
        for i in range(N):
            ans *= pow(A[i],factorial(A[i]))
            if ans > mod1:
                print(mod1)
                exit()
        print(mod1%ans)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0