結果
問題 | No.1630 Sorting Integers (Greater than K) |
ユーザー | nok0 |
提出日時 | 2021-07-30 21:11:34 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 862 bytes |
コンパイル時間 | 1,265 ms |
コンパイル使用メモリ | 86,884 KB |
実行使用メモリ | 75,712 KB |
最終ジャッジ日時 | 2023-10-14 02:35:46 |
合計ジャッジ時間 | 6,003 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
75,712 KB |
testcase_01 | AC | 74 ms
71,300 KB |
testcase_02 | AC | 75 ms
71,216 KB |
testcase_03 | AC | 74 ms
71,292 KB |
testcase_04 | AC | 74 ms
71,340 KB |
testcase_05 | AC | 72 ms
71,224 KB |
testcase_06 | AC | 73 ms
71,380 KB |
testcase_07 | AC | 75 ms
71,072 KB |
testcase_08 | AC | 76 ms
71,088 KB |
testcase_09 | AC | 73 ms
71,364 KB |
testcase_10 | AC | 73 ms
70,984 KB |
testcase_11 | AC | 72 ms
71,052 KB |
testcase_12 | AC | 75 ms
71,220 KB |
testcase_13 | AC | 81 ms
71,360 KB |
testcase_14 | AC | 79 ms
71,152 KB |
testcase_15 | AC | 76 ms
71,200 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
n, k = map(str, input().split()) k = list(map(int, k)) k.reverse() n = int(n) while len(k) < n: k.append(0) k.reverse() c = list(map(int, input().split())) co = c.copy() pl = -1 sf = 1 for i in range(n): tmp = 1 if k[i]: if c[k[i] - 1] == 0: tmp = 0 else: c[k[i] - 1] -= 1 else: tmp = 0 for j in range(k[i], 9): if c[j]: pl = i if tmp == 0: c[j] -= 1 break if tmp == 0: break if pl == -1: print(-1) else: res = "" for i in range(0, pl): res += str(k[i]) co[k[i] - 1] -= 1 for j in range(k[pl], 9): if co[j]: res += str(j + 1) co[j] -= 1 break for i in range(9): for j in range(co[i]): res += str(i + 1) print(res)