結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
lumc_
|
| 提出日時 | 2019-11-22 23:04:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 763 bytes |
| コンパイル時間 | 1,175 ms |
| コンパイル使用メモリ | 108,604 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-11 04:42:15 |
| 合計ジャッジ時間 | 2,159 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 20 |
ソースコード
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
string s;
cin >> s;
sort(rbegin(s), rend(s));
if(s[0] == s.back()) return cout << -1 << endl, 0;
for(int i = s.size() - 1; i >= 0; i++) {
if(s[i] != s[i-1]) {
swap(s[i], s[i-1]);
break;
}
}
if(s[0] == '0') return cout << -1 << endl, 0;
cout << s << endl;
return 0;
}
lumc_