結果
問題 |
No.3032 ホモトピー入門
|
ユーザー |
![]() |
提出日時 | 2025-02-21 22:14:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 293 ms |
コンパイル使用メモリ | 82,400 KB |
実行使用メモリ | 81,308 KB |
最終ジャッジ日時 | 2025-02-21 22:14:41 |
合計ジャッジ時間 | 8,170 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 25 |
ソースコード
n, m = map(int, input().split()) ans = 0 for _ in range(n): s = input() d = [] x = y = 0 for c in s: if c == 'L': match (x, y): case (0, 0): d.append(0) case (0, 1): d.append(1) case (0, 1): d.append(2) case (1, 1): d.append(3) x -= 1 elif c == 'R': x += 1 match (x, y): case (0, 0): d.append(0) case (0, 1): d.append(1) case (0, 1): d.append(2) case (1, 1): d.append(3) elif c == 'U': y += 1 else: y -= 1 if len(d) >= 2 and d[-1] == d[-2]: d.pop() d.pop() if len(d) == 0: ans += 1 print(ans)