結果
| 問題 | No.1133 キムワイプイーター |
| ユーザー |
|
| 提出日時 | 2020-07-31 23:03:47 |
| 言語 | Rust (1.92.0 + proconio + num) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 946 bytes |
| 記録 | |
| コンパイル時間 | 13,580 ms |
| コンパイル使用メモリ | 391,196 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 20:49:30 |
| 合計ジャッジ時間 | 15,406 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
fn main() {
let mut nm = String::new();
std::io::stdin().read_line(&mut nm).ok();
let nm: Vec<isize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
let n = nm[0];
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
let mut pos: (isize, isize) = (0, 0);
let mut mapping: Vec<Vec<usize>> = vec![vec![1; n as usize +1]; n as usize +1];
mapping[0][0] = 0;
s.trim().chars().for_each(|c| {
match c {
'U' => { pos.0 += 1; },
'D' => { pos.0 -= 1; },
'R' => { pos.1 += 1; },
'L' => { pos.1 -= 1; },
_ => {},
}
if pos.0 >= 0 && pos.0 <= n && pos.1 >= 0 && pos.1 <= n {
mapping[pos.0 as usize][pos.1 as usize] = 0;
}
});
mapping.iter().rev().for_each(|line| {
println!("{}", line.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(" "));
});
}