結果
問題 | No.927 Second Permutation |
ユーザー | stng |
提出日時 | 2022-08-15 10:13:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 82,760 KB |
実行使用メモリ | 74,028 KB |
最終ジャッジ日時 | 2024-04-09 22:22:36 |
合計ジャッジ時間 | 2,768 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
53,004 KB |
testcase_01 | AC | 33 ms
51,692 KB |
testcase_02 | AC | 34 ms
52,876 KB |
testcase_03 | AC | 34 ms
53,344 KB |
testcase_04 | AC | 32 ms
53,628 KB |
testcase_05 | AC | 34 ms
52,360 KB |
testcase_06 | AC | 33 ms
52,524 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 51 ms
70,600 KB |
testcase_25 | AC | 48 ms
66,984 KB |
testcase_26 | AC | 44 ms
64,304 KB |
testcase_27 | AC | 43 ms
63,204 KB |
testcase_28 | AC | 48 ms
70,512 KB |
testcase_29 | AC | 47 ms
67,828 KB |
ソースコード
x = input() li = [] for i in range(len(x)): li.append(x[i]) #print(li) li.sort(reverse=True) mx = ''.join(li) #print(li) li.sort() fv = li[0] for i in range(1,len(x)): if fv != li[i]: tmp = li[i] li[i] = fv li[0] = tmp break li = li[::-1] if li[0] == "0": print(-1) exit() ans = ''.join(li) if mx != ans: print(ans) else: print(-1)