結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-21 01:20:51 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| + 775µs | |
| コード長 | 314 bytes |
| 記録 | |
| コンパイル時間 | 1,221 ms |
| コンパイル使用メモリ | 216,224 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-15 04:26:39 |
| 合計ジャッジ時間 | 3,149 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}