結果
問題 |
No.3032 ホモトピー入門
|
ユーザー |
|
提出日時 | 2025-02-21 22:25:26 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 14,455 ms |
コンパイル使用メモリ | 402,500 KB |
実行使用メモリ | 59,620 KB |
最終ジャッジ日時 | 2025-02-21 22:25:45 |
合計ジャッジ時間 | 17,085 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 4 WA * 33 |
コンパイルメッセージ
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 = 0; let mut cross2 = 0; 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) { cross1 += 1; } if x >= 1 && (y, ny) == (1, 0) { cross1 -= 1; } if x >= 0 && (y, ny) == (0, 1) { cross2 += 1; } if x >= 0 && (y, ny) == (1, 0) { cross2 -= 1; } } if cross1 == 0 && cross2 == 0 { ans += 1; } } println!("{ans}"); }