結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-06 10:45:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 280 ms / 2,000 ms |
| コード長 | 440 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 12,608 KB |
| 最終ジャッジ日時 | 2024-07-02 17:46:59 |
| 合計ジャッジ時間 | 5,179 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
X=sorted([int(s) for s in list(input())])
X_set=sorted(list(set(X)))
if len(X_set)==1 or (len(X_set)==2 and X_set[0]==0 and X.count(X_set[1])==1):
print(-1)
else:
for i in range(1,len(X)):
if X[i]!=X[i-1]:
a=0
a+=X[i]
b=0
b+=X[i-1]
X[i]=b
X[i-1]=a
break
ans=""
for i in range(len(X)):
ans+=str(X[len(X)-i-1])
print(ans)