結果

問題 No.1292 パタパタ三角形
ユーザー rlangevinrlangevin
提出日時 2023-10-08 01:42:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 116,832 KB
最終ジャッジ日時 2023-10-08 01:42:10
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,624 KB
testcase_01 AC 74 ms
71,540 KB
testcase_02 AC 74 ms
71,584 KB
testcase_03 AC 73 ms
71,456 KB
testcase_04 AC 72 ms
71,256 KB
testcase_05 AC 80 ms
71,212 KB
testcase_06 AC 71 ms
71,436 KB
testcase_07 AC 141 ms
91,040 KB
testcase_08 AC 140 ms
89,812 KB
testcase_09 AC 169 ms
116,792 KB
testcase_10 AC 164 ms
116,832 KB
testcase_11 AC 163 ms
116,560 KB
testcase_12 AC 146 ms
109,984 KB
testcase_13 AC 156 ms
116,668 KB
testcase_14 AC 94 ms
79,712 KB
testcase_15 AC 93 ms
79,776 KB
testcase_16 AC 95 ms
80,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
SS = set()
x, y = 0, 0
SS.add((0, 0))
for s in S:
    if s == "a":
        if x % 3 == 1:
            x += 1
        elif x % 3 == 2:
            x -= 1
        else:
            if (x - 3 * y) % 6 == 0:
                y -= 1
            else:
                y += 1
    elif s == "b":
        if x % 3 == 0:
            x += 1
        elif x % 3 == 1:
            x -= 1
        else:
            if (x - 3 * y) % 6 == 2:
                y -= 1
            else:
                y += 1
    else:
        if x % 3 == 2:
            x += 1
        elif x % 3 == 0:
            x -= 1
        else:
            if (x - 3 * y) % 6 == 4:
                y -= 1
            else:
                y += 1
    SS.add((x, y))

print(len(SS))
0