結果

問題 No.1292 パタパタ三角形
ユーザー 👑 KazunKazun
提出日時 2020-11-20 21:43:19
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 242 ms
使用メモリ 110,604 KB
最終ジャッジ日時 2023-02-23 18:07:34
合計ジャッジ時間 3,389 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 79 ms
75,492 KB
testcase_01 AC 79 ms
75,752 KB
testcase_02 AC 81 ms
75,660 KB
testcase_03 AC 81 ms
75,436 KB
testcase_04 AC 79 ms
75,456 KB
testcase_05 AC 81 ms
75,492 KB
testcase_06 AC 81 ms
75,768 KB
testcase_07 AC 156 ms
86,228 KB
testcase_08 AC 150 ms
87,188 KB
testcase_09 AC 174 ms
110,604 KB
testcase_10 AC 175 ms
109,512 KB
testcase_11 AC 175 ms
105,196 KB
testcase_12 AC 134 ms
102,232 KB
testcase_13 AC 133 ms
102,352 KB
testcase_14 AC 107 ms
80,904 KB
testcase_15 AC 105 ms
81,208 KB
testcase_16 AC 105 ms
81,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input();N=len(S)

X={(0,0)}
u,d,l,r="a","*","b","c"
x=y=0

for s in S:
    if (x+y)%2==0:
        if s==u:
            y+=1
            u,d=d,u
        elif s==l:
            x-=1
            u,d,l,r="*",r,u,l
        elif s==r:
            x+=1
            u,d,l,r="*",l,r,u
    else:
        if s==d:
            y-=1
            u,d=d,u
        elif s==l:
            x-=1
            u,d,l,r=r,"*",d,l
        elif s==r:
            x+=1
            u,d,l,r=l,"*",r,d
    X.add((x,y))
print(len(X))
0