結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
yukileo9
|
| 提出日時 | 2021-07-13 08:51:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 431 bytes |
| コンパイル時間 | 1,421 ms |
| コンパイル使用メモリ | 171,924 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-02 11:21:59 |
| 合計ジャッジ時間 | 2,450 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void no_927(void) {
string x;
cin >> x;
int x_size = (int)x.size();
sort(x.begin(), x.end());
reverse(x.begin(), x.end());
if(!prev_permutation(x.begin(),x.end())){
cout << "-1" << endl;
return;
}
if(x[0]=='0'){
cout << "-1" << endl;
return;
}
cout << x << endl;
}
int main(void) {
no_927();
return 0;
}
yukileo9