結果
問題 | No.1292 パタパタ三角形 |
ユーザー | mkawa2 |
提出日時 | 2023-02-08 23:54:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 1,014 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 87,216 KB |
実行使用メモリ | 108,308 KB |
最終ジャッジ日時 | 2023-09-20 13:11:31 |
合計ジャッジ時間 | 3,317 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,280 KB |
testcase_01 | AC | 74 ms
71,284 KB |
testcase_02 | AC | 72 ms
71,444 KB |
testcase_03 | AC | 74 ms
71,324 KB |
testcase_04 | AC | 76 ms
71,684 KB |
testcase_05 | AC | 81 ms
71,440 KB |
testcase_06 | AC | 74 ms
71,400 KB |
testcase_07 | AC | 103 ms
82,076 KB |
testcase_08 | AC | 101 ms
81,312 KB |
testcase_09 | AC | 124 ms
108,148 KB |
testcase_10 | AC | 126 ms
108,188 KB |
testcase_11 | AC | 128 ms
108,308 KB |
testcase_12 | AC | 125 ms
108,148 KB |
testcase_13 | AC | 128 ms
108,156 KB |
testcase_14 | AC | 97 ms
76,832 KB |
testcase_15 | AC | 94 ms
77,176 KB |
testcase_16 | AC | 94 ms
76,836 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 dxy=[[(0,-1),(-1,0),(1,0)],[(0,1),(-1,0),(1,0)]] top=[0,0,1,2,2,1] to=[[1,5,3],[0,2,4],[3,1,5],[2,4,0],[5,3,1],[4,0,2]] s=SI() x=y=0 st=set() st.add((0,0)) v=0 for c in s: c=ord(c)-97 dx,dy=dxy[v&1][(top[v]+c)%3] x,y=x+dx,y+dy st.add((x,y)) v=to[v][c] print(len(st))