結果

問題 No.1292 パタパタ三角形
ユーザー KudeKude
提出日時 2020-11-20 22:03:17
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 449 ms
使用メモリ 110,112 KB
最終ジャッジ日時 2023-02-23 18:22:01
合計ジャッジ時間 3,493 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 77 ms
75,840 KB
testcase_01 AC 79 ms
75,652 KB
testcase_02 AC 78 ms
75,644 KB
testcase_03 AC 80 ms
75,452 KB
testcase_04 AC 76 ms
75,664 KB
testcase_05 AC 76 ms
75,620 KB
testcase_06 AC 75 ms
75,644 KB
testcase_07 AC 145 ms
86,932 KB
testcase_08 AC 147 ms
85,680 KB
testcase_09 AC 168 ms
105,460 KB
testcase_10 AC 175 ms
104,632 KB
testcase_11 AC 177 ms
104,744 KB
testcase_12 AC 150 ms
110,008 KB
testcase_13 AC 153 ms
110,112 KB
testcase_14 AC 101 ms
81,404 KB
testcase_15 AC 99 ms
81,172 KB
testcase_16 AC 103 ms
81,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

visited = {(0, 0)}
a = (1, 0)
b = (0, -1)
c = (-1, 0)
z = (0, 0)
for s in input():
    if s == 'a':
        z = z[0] + a[0], z[1] + a[1]
        if a[1] == 0:
            a = (-a[0], 0)
            b, c = c, b
            b = (-b[0], -b[1])
            c = (-c[0], -c[1])
        else:
            a = (0, -a[1])
    elif s == 'b':
        z = z[0] + b[0], z[1] + b[1]
        if b[1] == 0:
            b = (-b[0], 0)
            c, a = a, c
            c = (-c[0], -c[1])
            a = (-a[0], -a[1])
        else:
            b = (0, -b[1])
    else:
        z = z[0] + c[0], z[1] + c[1]
        if c[1] == 0:
            c = (-c[0], 0)
            a, b = b, a
            a = (-a[0], -a[1])
            b = (-b[0], -b[1])
        else:
            c = (0, -c[1])
    visited.add(z)
print(len(visited))
0