結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
|
提出日時 | 2020-11-20 23:51:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 357 ms / 2,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 41,152 KB |
最終ジャッジ日時 | 2024-07-23 14:02:07 |
合計ジャッジ時間 | 4,282 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
S = input()p = ["abc", "cab", "bca"]s = set([(0, 0)])x, y = 0, 0cur = 0for i in range(len(S)):ind = p[cur].index(S[i])cur += indcur %= 3if i % 2:if ind == 0:x += 1y += 1if ind == 1:y -= 2if ind == 2:x -= 1y += 1else:if ind == 0:x -= 1y -= 1if ind == 1:x += 1y -= 1if ind == 2:y += 2s.add((x, y))print(len(s))