結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー chineristACchineristAC
提出日時 2021-07-30 21:18:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 74,684 KB
最終ジャッジ日時 2023-10-14 03:02:45
合計ジャッジ時間 10,343 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
74,364 KB
testcase_01 AC 113 ms
74,668 KB
testcase_02 AC 112 ms
74,308 KB
testcase_03 AC 116 ms
74,116 KB
testcase_04 AC 113 ms
74,112 KB
testcase_05 AC 113 ms
74,108 KB
testcase_06 AC 113 ms
74,668 KB
testcase_07 AC 116 ms
74,296 KB
testcase_08 AC 115 ms
74,524 KB
testcase_09 AC 114 ms
74,112 KB
testcase_10 AC 114 ms
74,372 KB
testcase_11 AC 114 ms
74,624 KB
testcase_12 AC 114 ms
74,560 KB
testcase_13 AC 115 ms
74,300 KB
testcase_14 AC 115 ms
74,364 KB
testcase_15 AC 115 ms
74,628 KB
testcase_16 AC 116 ms
74,660 KB
testcase_17 AC 115 ms
74,424 KB
testcase_18 AC 116 ms
74,268 KB
testcase_19 WA -
testcase_20 AC 120 ms
74,336 KB
testcase_21 WA -
testcase_22 AC 113 ms
74,464 KB
testcase_23 AC 114 ms
74,116 KB
testcase_24 AC 114 ms
74,264 KB
testcase_25 AC 120 ms
74,308 KB
testcase_26 WA -
testcase_27 AC 115 ms
74,152 KB
testcase_28 AC 117 ms
74,124 KB
testcase_29 AC 116 ms
74,320 KB
testcase_30 AC 117 ms
74,308 KB
testcase_31 AC 115 ms
74,460 KB
testcase_32 AC 123 ms
74,492 KB
testcase_33 AC 115 ms
74,320 KB
testcase_34 WA -
testcase_35 AC 113 ms
74,116 KB
testcase_36 AC 117 ms
74,428 KB
testcase_37 WA -
testcase_38 AC 117 ms
74,664 KB
testcase_39 AC 114 ms
74,316 KB
testcase_40 AC 115 ms
74,320 KB
testcase_41 AC 116 ms
74,116 KB
testcase_42 AC 117 ms
74,664 KB
testcase_43 WA -
testcase_44 AC 116 ms
74,536 KB
testcase_45 AC 114 ms
74,452 KB
testcase_46 WA -
testcase_47 AC 113 ms
74,428 KB
testcase_48 AC 111 ms
74,532 KB
testcase_49 AC 113 ms
74,300 KB
testcase_50 AC 115 ms
74,568 KB
testcase_51 AC 113 ms
74,356 KB
testcase_52 AC 112 ms
74,364 KB
testcase_53 AC 112 ms
74,300 KB
testcase_54 AC 111 ms
74,360 KB
testcase_55 AC 112 ms
74,524 KB
testcase_56 AC 111 ms
74,432 KB
testcase_57 AC 116 ms
74,112 KB
testcase_58 AC 115 ms
74,364 KB
testcase_59 AC 113 ms
74,520 KB
testcase_60 AC 113 ms
74,312 KB
testcase_61 AC 113 ms
74,156 KB
testcase_62 AC 115 ms
74,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

mod = 10**9 + 7
i9 = pow(9,mod-2,mod)

N = int(input())
c = [0] + li()

def solve(N,c):
    for i in range(10):
        if c[i]==N:
            return i * (pow(10,N,mod)-1) * i9 % mod

    res = 1
    if any(c[2*i+1] for i in range(0,5)):
        res *= 1
    elif c[2] or c[6]:
        res *= 2
    elif c[4]:
        res *= 4
    else:
        res *= 8

    check = 0
    for i in range(10):
        check += c[i] * i
    if check%9==0:
        res *= 9
    elif check%3==0:
        res *= 3

    flag = True
    for i in range(1,10):
        for j in range(i+1,10):
            if c[i] and c[j] and (i-j)%7:
                flag = False
    if flag:
        check = 0
        for i in range(1,10):
            check  = check * pow(10,c[i],7) + i * (pow(10,c[i],7)-1) * 4
            check %= 7
        if check==0:
            res *= 7
    return res

print(solve(N,c))
0