結果
問題 |
No.3267 PQ Straight
|
ユーザー |
|
提出日時 | 2025-09-13 03:09:39 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 55 ms / 1,000 ms |
コード長 | 1,051 bytes |
コンパイル時間 | 18,384 ms |
コンパイル使用メモリ | 398,476 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-13 03:10:01 |
合計ジャッジ時間 | 17,393 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
use proconio::input; use std::collections::HashSet; fn main() { input! { n: usize, } if n % 2 == 0 { println!("No"); return; } let mut p = vec![]; let mut p_set = HashSet::new(); let mut q = vec![]; let mut target = (n + 3) / 2; for i in 1..=n / 2 + 1 { if p_set.contains(&i) { p.push(target - i); p_set.insert(target - i); q.push(i); } else { p.push(i); p_set.insert(i); q.push(target - i); } target += 1; if i == n / 2 + 1 { break; } if p_set.contains(&i) { p.push(target - i); p_set.insert(target - i); q.push(i); } else { p.push(i); p_set.insert(i); q.push(target - i); } target += 1; } println!("Yes"); for i in p { print!("{} ", i); } println!(); for i in q { print!("{} ", i); } println!(); }