結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2021-11-03 01:57:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 70,400 KB |
| 最終ジャッジ日時 | 2026-04-28 23:18:26 |
| 合計ジャッジ時間 | 3,648 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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