結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2021-11-03 01:57:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 352 ms |
| コンパイル使用メモリ | 82,264 KB |
| 実行使用メモリ | 71,740 KB |
| 最終ジャッジ日時 | 2024-10-12 09:57:53 |
| 合計ジャッジ時間 | 3,048 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 17 |
ソースコード
import collections
X = list(input())
C = collections.Counter(X)
if len(C)==1:
print(-1)
exit()
cnt = 0
for k,v in C.items():
if k!='0':
cnt+=v
if cnt==1:
print(-1)
exit()
for i in range(0,10):
for j in range(i+1,10):
if C[str(i)] and C[str(j)]:
ans = ''
for k in reversed(range(10)):
ans+=str(k)*(C[str(k)]-int(k==j))
if k==i:
ans+=str(j)
print(ans)
exit()
H20