結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-17 11:04:21 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| コード長 | 290 bytes |
| 記録 | |
| コンパイル時間 | 224 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 90,240 KB |
| 最終ジャッジ日時 | 2026-04-04 17:26:40 |
| 合計ジャッジ時間 | 2,478 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
X = input()
l = list(map(int,list(X)))
s = set(l)
N = len(l)
import sys
if len(s) == 1:
print(-1)
exit()
l.sort(reverse = True)
u = N - 1
while l[u] == l[-1]:
u -= 1
l[u],l[u + 1] = l[u + 1],l[u]
if l[0] == 0:
print(-1)
exit()
for i in l:
print(i,end = "")
print()