結果
問題 | No.5006 Hidden Maze |
ユーザー |
![]() |
提出日時 | 2022-06-12 14:47:14 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 1,003 bytes |
コンパイル時間 | 984 ms |
実行使用メモリ | 22,768 KB |
スコア | 0 |
平均クエリ数 | 1001.00 |
最終ジャッジ日時 | 2022-06-12 14:47:33 |
合計ジャッジ時間 | 11,358 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
コンパイルメッセージ
warning: unused variable: `h` --> Main.rs:25:10 | 25 | let (h, w, p) = { | ^ help: if this is intentional, prefix it with an underscore: `_h` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `w` --> Main.rs:25:13 | 25 | let (h, w, p) = { | ^ help: if this is intentional, prefix it with an underscore: `_w` warning: unused variable: `p` --> Main.rs:25:16 | 25 | let (h, w, p) = { | ^ help: if this is intentional, prefix it with an underscore: `_p` warning: 3 warnings emitted
ソースコード
fn rand_memory() -> usize { Box::into_raw(Box::new("I hope this is a random number")) as usize } fn rand() -> usize { static mut X: usize = 0; unsafe { if X == 0 { X = rand_memory(); } X ^= X << 13; X ^= X >> 17; X ^= X << 5; X } } fn read() -> Vec<i32> { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s.trim().split_whitespace().flat_map(|s| s.parse()).collect() } fn main() { let (h, w, p) = { let a = read(); (a[0] as usize, a[1] as usize, a[2] as u32) }; for _ in 0..1001 { let mut s = String::new(); let mut c = b'L'; while s.len() < 400 { s.extend("RD".chars().cycle().take(rand() % 20 + 10)); s.extend((0..(rand() % 5 + 1)).map(|_| c as char)); c ^= b'L' ^ b'U'; } s.truncate(400); println!("{}", s); if read()[0] == -1 { break; } } }