結果
問題 | No.1630 Sorting Integers (Greater than K) |
ユーザー | PSL24251284 |
提出日時 | 2021-07-31 04:22:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 87,268 KB |
実行使用メモリ | 78,316 KB |
最終ジャッジ日時 | 2023-10-14 13:44:04 |
合計ジャッジ時間 | 5,825 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
78,316 KB |
testcase_01 | WA | - |
testcase_02 | AC | 77 ms
71,404 KB |
testcase_03 | AC | 75 ms
71,216 KB |
testcase_04 | AC | 75 ms
71,372 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 74 ms
71,096 KB |
testcase_09 | AC | 76 ms
71,308 KB |
testcase_10 | WA | - |
testcase_11 | AC | 82 ms
76,140 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
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 = input().split() d = [0] + list(map(int,input().split())) c = d.copy() N = int(N) if len(K) > N: print(-1) exit() for i in range(N-len(K)): K = "0" + K #print(K) a = "" for i0 in range(10): for j in range(c[i0]): a = a + str(i0) ans = [a] s = "" for i in range(N): v = int(K[i]) if c[v]: s = s + str(v) c[v] -= 1 a = s for i0 in range(10): for j in range(c[i0]): a = a + str(i0) ans.append(a) else: break for i in range(int(K[0])+1,10): if d[i]: a = str(i) d[i] -= 1 for i0 in range(10): for j in range(d[i0]): a = a + str(i0) ans.append(a) for v in ans: if K < v: print(v) exit() print(-1)