結果

問題 No.1292 パタパタ三角形
ユーザー sepa38sepa38
提出日時 2023-03-29 09:57:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 81,600 KB
実行使用メモリ 105,848 KB
最終ジャッジ日時 2023-10-21 02:43:59
合計ジャッジ時間 3,196 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,428 KB
testcase_01 AC 40 ms
53,428 KB
testcase_02 AC 40 ms
53,428 KB
testcase_03 AC 41 ms
53,428 KB
testcase_04 AC 39 ms
53,428 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 208 ms
104,844 KB
testcase_13 AC 203 ms
105,848 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 102 ms
89,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = list(map(lambda x: ord(x)-97, input()))
dir = [[-1, 0], [1, 0], [0, -1]]
flg = 1
now = [0, 0]
st = set([tuple(now)])
for c in s:
  x, y = dir[c]
  now[0] += x
  now[1] += y
  st.add(tuple(now))
  if dir[c] == [-1, 0]:
    if flg:
      for i in range(3):
        if dir[i] == [-1, 0]:
          dir[i] = [1, 0]
        if dir[i] == [1, 0]:
          dir[i] = [0, 1]
        if dir[i] == [0, -1]:
          dir[i] = [0, 1]
    else:
      for i in range(3):
        if dir[i] == [-1, 0]:
          dir[i] = [1, 0]
        if dir[i] == [1, 0]:
          dir[i] = [0, -1]
        if dir[i] == [0, 1]:
          dir[i] = [-1, 0]
  elif dir[c] == [1, 0]:
    if flg:
      for i in range(3):
        if dir[i] == [1, 0]:
          dir[i] = [-1, 0]
        if dir[i] == [-1, 0]:
          dir[i] = [0, 1]
        if dir[i] == [0, -1]:
          dir[i] = [1, 0]
    else:
      for i in range(3):
        if dir[i] == [1, 0]:
          dir[i] = [-1, 0]
        if dir[i] == [-1, 0]:
          dir[i] = [0, -1]
        if dir[i] == [0, 1]:
          dir[i] = [1, 0]
  elif dir[c] == [0, -1]:
    dir[c] = [0, 1]
  elif dir[c] == [0, 1]:
    dir[c] = [0, -1]
  flg ^= 1
print(len(st))
0