結果
| 問題 |
No.3032 ホモトピー入門
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-21 22:23:06 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 654 bytes |
| コンパイル時間 | 14,257 ms |
| コンパイル使用メモリ | 402,964 KB |
| 実行使用メモリ | 59,740 KB |
| 最終ジャッジ日時 | 2025-02-21 22:23:23 |
| 合計ジャッジ時間 | 16,335 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 31 |
コンパイルメッセージ
warning: unused variable: `m` --> src/main.rs:4:13 | 4 | n: usize, m: usize, | ^ help: if this is intentional, prefix it with an underscore: `_m` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `nx` --> src/main.rs:15:13 | 15 | let (ny, nx) = | ^^ help: if this is intentional, prefix it with an underscore: `_nx` warning: variable does not need to be mutable --> src/main.rs:10:7 | 10 | let mut y = 0; | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> src/main.rs:11:7 | 11 | let mut x = 0; | ----^ | | | help: remove this `mut`
ソースコード
use proconio::{input, marker::Chars};
fn main() {
input! {
n: usize, m: usize,
curves: [Chars; n],
}
let mut ans = 0;
for curve in curves {
let mut y = 0;
let mut x = 0;
let mut cross1 = false;
let mut cross2 = false;
for c in curve {
let (ny, nx) =
match c {
'U' => (y + 1, x),
'D' => (y - 1, x),
'L' => (y, x - 1),
'R' => (y, x + 1),
_ => unreachable!()
};
if x >= 1 && ((y, ny) == (0, 1) || (y, ny) == (1, 0)) {
cross1 ^= true;
}
if x >= 0 && ((y, ny) == (0, 1) || (y, ny) == (1, 0)) {
cross2 ^= true;
}
}
if !cross1 && !cross2 {
ans += 1;
}
}
println!("{ans}");
}