結果
問題 | No.1629 Sorting Integers (SUM of M) |
ユーザー | convexineq |
提出日時 | 2021-07-30 21:11:21 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 815 bytes |
コンパイル時間 | 631 ms |
コンパイル使用メモリ | 87,092 KB |
実行使用メモリ | 81,044 KB |
最終ジャッジ日時 | 2023-10-14 02:35:29 |
合計ジャッジ時間 | 3,780 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 78 ms
78,288 KB |
testcase_01 | AC | 80 ms
78,148 KB |
testcase_02 | AC | 81 ms
78,204 KB |
testcase_03 | AC | 81 ms
78,168 KB |
testcase_04 | AC | 84 ms
78,036 KB |
testcase_05 | AC | 82 ms
78,156 KB |
testcase_06 | AC | 81 ms
78,324 KB |
testcase_07 | RE | - |
testcase_08 | AC | 81 ms
78,180 KB |
testcase_09 | RE | - |
testcase_10 | AC | 81 ms
78,180 KB |
testcase_11 | AC | 83 ms
78,024 KB |
testcase_12 | AC | 84 ms
78,192 KB |
testcase_13 | RE | - |
testcase_14 | AC | 82 ms
78,188 KB |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
ソースコード
SIZE=10**5+1; MOD=10**9+7 #998244353 #ここを変更する inv = [0]*SIZE # inv[j] = j^{-1} mod MOD fac = [0]*SIZE # fac[j] = j! mod MOD finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD fac[0] = fac[1] = 1 finv[0] = finv[1] = 1 for i in range(2,SIZE): fac[i] = fac[i-1]*i%MOD finv[-1] = pow(fac[-1],MOD-2,MOD) for i in range(SIZE-1,0,-1): finv[i-1] = finv[i]*i%MOD inv[i] = finv[i]*fac[i-1]%MOD def choose(n,r): # nCk mod MOD の計算 if 0 <= r <= n: return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD else: return 0 n,*c = map(int,open(0).read().split()) r = k = 0 for i in range(9): if c[i] == 0: continue cc = c[:] cc[i] -= 1 v = fac[n-1] for j in cc: v *= finv[j] v %= MOD r += (i+1)*v for i in range(n): k = (k*10+1)%MOD print(r*k%MOD)