結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-30 13:57:04 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 112 ms / 2,000 ms |
| コード長 | 247 bytes |
| 記録 | |
| コンパイル時間 | 472 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 16,088 KB |
| 最終ジャッジ日時 | 2026-03-04 10:21:37 |
| 合計ジャッジ時間 | 4,867 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
x=list(input())
x.sort(reverse=True)
n=len(x)
if len(set(x))==1:
print(-1)
exit()
if x.count('0')==n-1:
print(-1)
exit()
for i in range(n-1,0,-1):
if x[i]!=x[i-1]:
x[i],x[i-1]=x[i-1],x[i]
break
print(''.join(x))