結果

問題 No.1292 パタパタ三角形
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-11-20 23:51:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 38,396 KB
最終ジャッジ日時 2023-09-30 20:12:54
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,904 KB
testcase_01 AC 15 ms
7,740 KB
testcase_02 AC 14 ms
7,764 KB
testcase_03 AC 15 ms
7,796 KB
testcase_04 AC 15 ms
7,912 KB
testcase_05 AC 14 ms
7,816 KB
testcase_06 AC 15 ms
7,876 KB
testcase_07 AC 218 ms
14,420 KB
testcase_08 AC 218 ms
14,228 KB
testcase_09 AC 285 ms
38,396 KB
testcase_10 AC 280 ms
38,024 KB
testcase_11 AC 281 ms
38,028 KB
testcase_12 AC 272 ms
38,216 KB
testcase_13 AC 281 ms
35,236 KB
testcase_14 AC 196 ms
8,356 KB
testcase_15 AC 198 ms
8,296 KB
testcase_16 AC 186 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
p = ["abc", "cab", "bca"]
s = set([(0, 0)])
x, y = 0, 0
cur = 0
for i in range(len(S)):
    ind = p[cur].index(S[i])
    cur += ind
    cur %= 3
    if i % 2:
        if ind == 0:
            x += 1
            y += 1
        if ind == 1:
            y -= 2
        if ind == 2:
            x -= 1
            y += 1
    else:
        if ind == 0:
            x -= 1
            y -= 1
        if ind == 1:
            x += 1
            y -= 1
        if ind == 2:
            y += 2
    s.add((x, y))
print(len(s))
0