結果
問題 |
No.3032 ホモトピー入門
|
ユーザー |
|
提出日時 | 2025-02-21 22:29:56 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 740 bytes |
コンパイル時間 | 16,431 ms |
コンパイル使用メモリ | 388,948 KB |
実行使用メモリ | 59,564 KB |
最終ジャッジ日時 | 2025-02-21 22:30:32 |
合計ジャッジ時間 | 17,353 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 10 |
コンパイルメッセージ
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
ソースコード
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; } x = nx; y = ny; } if cross1 == 0 && cross2 == 0 { ans += 1; } } println!("{ans}"); }