結果
問題 |
No.1707 Simple Range Reverse Problem
|
ユーザー |
|
提出日時 | 2021-10-15 23:06:01 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,085 bytes |
コンパイル時間 | 12,658 ms |
コンパイル使用メモリ | 405,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 18:07:22 |
合計ジャッジ時間 | 13,711 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 13 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let t: usize = itr.next().unwrap().parse().unwrap(); for _ in 0..t { let n: usize = itr.next().unwrap().parse().unwrap(); let a: Vec<usize> = (0..n * 2) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut ok = true; let mut ok1 = true; let mut ok2 = true; let mut b = Vec::new(); let mut c = Vec::new(); b.push(1); for i in (2..=n).rev() { b.push(i); } for i in 1..=n { b.push(i); c.push(i); } for i in (1..n).rev() { c.push(i); } c.push(n); for i in 0..n * 2 { ok &= a[i] == i % n + 1; ok1 &= a[i] == b[i]; ok2 &= a[i] == c[i]; } if ok || ok1 || ok2 { println!("Yes"); } else { println!("No"); } } }