結果

問題 No.1292 パタパタ三角形
ユーザー 👑 KazunKazun
提出日時 2020-11-20 21:43:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 103,224 KB
最終ジャッジ日時 2023-09-30 19:05:27
合計ジャッジ時間 2,764 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,292 KB
testcase_01 AC 72 ms
71,028 KB
testcase_02 AC 71 ms
71,380 KB
testcase_03 AC 72 ms
71,360 KB
testcase_04 AC 76 ms
71,148 KB
testcase_05 AC 71 ms
71,240 KB
testcase_06 AC 71 ms
71,484 KB
testcase_07 AC 115 ms
81,896 KB
testcase_08 AC 114 ms
81,620 KB
testcase_09 AC 137 ms
103,200 KB
testcase_10 AC 135 ms
101,996 KB
testcase_11 AC 137 ms
103,224 KB
testcase_12 AC 126 ms
100,516 KB
testcase_13 AC 124 ms
100,496 KB
testcase_14 AC 90 ms
76,532 KB
testcase_15 AC 90 ms
76,536 KB
testcase_16 AC 93 ms
76,664 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