結果
問題 | No.927 Second Permutation |
ユーザー |
|
提出日時 | 2020-12-21 11:42:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 285 bytes |
コンパイル時間 | 1,887 ms |
コンパイル使用メモリ | 170,320 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-21 12:49:49 |
合計ジャッジ時間 | 3,651 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {string s;cin >> s;sort(s.begin(), s.end(), greater<>());string t = s;prev_permutation(t.begin(), t.end());if (t[0] == '0' || s == t) {cout << "-1\n";}else {cout << t << '\n';}return 0;}