結果
問題 | No.927 Second Permutation |
ユーザー |
![]() |
提出日時 | 2019-11-22 23:00:55 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 14,704 ms |
コンパイル使用メモリ | 387,908 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 04:36:22 |
合計ジャッジ時間 | 15,545 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 27 |
ソースコード
use std::io::{Read, stdin}; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut tok = buf.split_whitespace(); let mut get = || tok.next().unwrap(); let mut x = get() .as_bytes() .iter() .cloned() .collect::<Vec<_>>(); x.sort(); let find = x .iter() .enumerate() .find(|(_,s)| **s != x[0]); let ans = match find { None => "-1".to_string(), Some((i, _)) => { x.swap(0, i); x.reverse(); String::from_utf8(x).unwrap() } }; println!("{:?}", ans); }