結果
| 問題 | No.1707 Simple Range Reverse Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-18 21:29:41 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 824 bytes |
| 記録 | |
| コンパイル時間 | 15,305 ms |
| コンパイル使用メモリ | 388,372 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-07-13 03:54:00 |
| 合計ジャッジ時間 | 12,065 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
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();
}
}