結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-21 01:20:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 1,727 ms |
| コンパイル使用メモリ | 201,724 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-21 01:20:55 |
| 合計ジャッジ時間 | 3,301 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
sort(s.rbegin(),s.rend());
prev_permutation(s.begin(),s.end());
if(s[0]==s.back() || s[0]=='0') cout << -1 << '\n';
else cout << s << '\n';
return 0;
}