結果
| 問題 |
No.1629 Sorting Integers (SUM of M)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-30 21:01:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 259,968 KB |
| 最終ジャッジ日時 | 2024-09-15 21:30:42 |
| 合計ジャッジ時間 | 4,715 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 13 |
ソースコード
import typing
from itertools import (
permutations,
)
def main() -> typing.NoReturn:
mod = 10 ** 9 + 7
n = int(input())
*c, = map(
int, input().split(),
)
a = []
for i in range(9):
a += [i + 1] * c[i]
*perms, = set(
permutations(a),
)
s = [0] * n
for p in perms:
for i in range(n):
s[i] += p[i]
s[i] %= mod
d = 1
tot = 0
for i in range(n):
tot += d * s[i]
d *= 10
print(tot % mod)
main()