結果
問題 | No.1632 Sorting Integers (GCD of M) |
ユーザー |
|
提出日時 | 2021-07-30 21:13:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 55,680 KB |
最終ジャッジ日時 | 2024-09-15 22:24:06 |
合計ジャッジ時間 | 4,948 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 46 WA * 13 |
ソースコード
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 return res print(solve(N,c))