結果
問題 | No.5006 Hidden Maze |
ユーザー |
![]() |
提出日時 | 2022-06-12 14:57:21 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 1,029 bytes |
コンパイル時間 | 2,928 ms |
実行使用メモリ | 22,864 KB |
スコア | 0 |
平均クエリ数 | 1001.00 |
最終ジャッジ日時 | 2022-06-12 14:57:54 |
合計ジャッジ時間 | 13,117 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)};loop {let mut s = String::new();let mut p = "LD";let mut q = "UR";while s.len() < 400 {s.extend("RD".chars().cycle().take(rand() % 20 + 10));s.extend(p.chars().cycle().take(rand() % 4 + 4));std::mem::swap(&mut p, &mut q);}s.truncate(400);println!("{}", s);if read()[0] == -1 {break;}}}