結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
|
提出日時 | 2022-10-18 01:25:44 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 913 bytes |
コンパイル時間 | 13,318 ms |
コンパイル使用メモリ | 380,184 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 13:36:05 |
合計ジャッジ時間 | 14,463 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 WA * 9 |
ソースコード
fn main() {let mut t = String::new();std::io::stdin().read_line(&mut t).ok();let t: usize = t.trim().parse().unwrap();for _ in 0..t {let mut n = String::new();std::io::stdin().read_line(&mut n).ok();let n: usize = n.trim().parse().unwrap();let mut a = String::new();std::io::stdin().read_line(&mut a).ok();let mut a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();let x = (0..2*n).map(|i| i%n + 1).collect::<Vec<_>>();if a == x {println!("Yes");continue;}let idx = (0..n).filter(|&i| a[i] == i+1).max().unwrap_or(n);if idx == n {println!("No");continue;}a[idx..=idx+n].reverse();if a == x {println!("Yes");} else {println!("No");}}}