結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
Bwambocos
|
| 提出日時 | 2019-11-22 21:58:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 349 bytes |
| コンパイル時間 | 2,452 ms |
| コンパイル使用メモリ | 198,356 KB |
| 最終ジャッジ日時 | 2025-01-08 04:59:06 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 17 |
ソースコード
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
int main()
{
std::string X;
in >> X;
std::sort(X.rbegin(), X.rend());
auto s1 = X;
std::swap(X[X.length() - 2], X[X.length() - 1]);
auto s2 = X;
out << ((s1 == s2 || s2[0] == '0') ? "-1" : s2) << std::endl;
}
Bwambocos