結果
問題 | No.927 Second Permutation |
ユーザー |
👑 |
提出日時 | 2019-11-30 21:23:34 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 339 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 03:35:14 |
合計ジャッジ時間 | 1,977 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
local s = io.read()local n = #slocal t = {}for i = 1, n dot[i] = tonumber(s:sub(i, i))endtable.sort(t, function(a, b) return a > b end)if t[2] == 0 or t[1] == t[n] thenprint(-1)elsefor i = n, 2, -1 doif t[i] ~= t[i - 1] thent[i], t[i - 1] = t[i - 1], t[i]breakendendprint(table.concat(t))end