結果
問題 | No.3032 ホモトピー入門 |
ユーザー |
|
提出日時 | 2025-02-21 22:59:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,576 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 197,880 KB |
最終ジャッジ日時 | 2025-02-21 22:59:53 |
合計ジャッジ時間 | 10,612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 10 |
ソースコード
import sysinput = lambda :sys.stdin.readline()[:-1]ni = lambda :int(input())na = lambda :list(map(int,input().split()))yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")#######################################################################def rot(s):x, y = 0, 0ans = 0for c in s:if c == "R":if x == 0:if y <= 0:ans += 1else:ans -= 1x += 1elif c == "L":if x == 1:if y <= 0:ans -= 1else:ans += 1x -= 1elif c == "U":if y == 0:if x <= 0:ans -= 1else:ans += 1y += 1else:if y == 1:if x <= 0:ans += 1else:ans -= 1y -= 1assert x == 0 and y == 0 and ans % 4 == 0# print(ans)return ansdef convert(s):res = []for i in s:if i == "L":res.append("R")elif i == "R":res.append("L")else:res.append(i)return "".join(res)n, m = na()ans = 0for i in range(n):s = input()#print(rot(s) ,rot(convert(s)))X = rot(s)//4Y = -rot(convert(s))//4if X + Y == 0 and X % 4 == 0:ans += 1print(ans)