結果
問題 | No.1707 Simple Range Reverse Problem |
ユーザー |
|
提出日時 | 2022-10-18 21:29:41 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 824 bytes |
コンパイル時間 | 10,582 ms |
コンパイル使用メモリ | 401,532 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 03:54:58 |
合計ジャッジ時間 | 11,802 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 |
ソースコード
fn solve() {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 a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();let x = (0..2*n).map(|j| j%n+1).collect::<Vec<_>>();if a == x {println!("Yes");return;}for i in 0..n {let mut x = (0..2*n).map(|j| j%n+1).collect::<Vec<_>>();x[i..=n+i].reverse();if x == a {println!("Yes");return;}}println!("No");}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 {solve();}}