結果

問題 No.1292 パタパタ三角形
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-15 20:42:18
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 105,864 KB
最終ジャッジ日時 2023-09-30 18:47:49
合計ジャッジ時間 3,381 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,948 KB
testcase_01 AC 74 ms
71,480 KB
testcase_02 AC 75 ms
71,096 KB
testcase_03 AC 73 ms
71,320 KB
testcase_04 AC 73 ms
71,448 KB
testcase_05 AC 74 ms
71,124 KB
testcase_06 AC 73 ms
71,152 KB
testcase_07 AC 151 ms
82,896 KB
testcase_08 AC 147 ms
82,572 KB
testcase_09 AC 197 ms
105,260 KB
testcase_10 AC 196 ms
104,748 KB
testcase_11 AC 201 ms
104,784 KB
testcase_12 AC 189 ms
105,864 KB
testcase_13 AC 189 ms
104,880 KB
testcase_14 AC 121 ms
77,256 KB
testcase_15 AC 120 ms
77,340 KB
testcase_16 AC 119 ms
77,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
seen={(0,0)}
sts=['a','b','c','u'] # 底辺、右にある辺、左にある辺、三角形下向き上向
now=[0,0]
for si in s:
  if si==sts[0]:
    if sts[3]=='u':
      now[1]-=1
    else:
      now[1]+=1
  else:
    if si==sts[1]:# 右に移動
      now[0]+=1
      sts[0],sts[1],sts[2]=sts[2],sts[0],sts[1]
    else:
      now[0]-=1
      sts[0],sts[1],sts[2]=sts[1],sts[2],sts[0]
  seen.add(tuple(now))
  if sts[3]=='u':sts[3]='d'
  else:sts[3]='u'


print(len(seen))


0