結果
問題 | No.1292 パタパタ三角形 |
ユーザー | sepa38 |
提出日時 | 2023-03-29 10:07:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 245 ms / 2,000 ms |
コード長 | 1,216 bytes |
コンパイル時間 | 858 ms |
コンパイル使用メモリ | 81,840 KB |
実行使用メモリ | 109,760 KB |
最終ジャッジ日時 | 2023-10-21 02:50:56 |
合計ジャッジ時間 | 3,120 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,352 KB |
testcase_01 | AC | 37 ms
53,352 KB |
testcase_02 | AC | 35 ms
53,352 KB |
testcase_03 | AC | 37 ms
53,352 KB |
testcase_04 | AC | 39 ms
53,352 KB |
testcase_05 | AC | 41 ms
53,364 KB |
testcase_06 | AC | 35 ms
53,372 KB |
testcase_07 | AC | 185 ms
89,676 KB |
testcase_08 | AC | 177 ms
89,940 KB |
testcase_09 | AC | 218 ms
108,296 KB |
testcase_10 | AC | 232 ms
108,228 KB |
testcase_11 | AC | 245 ms
109,760 KB |
testcase_12 | AC | 179 ms
104,992 KB |
testcase_13 | AC | 190 ms
108,032 KB |
testcase_14 | AC | 123 ms
89,940 KB |
testcase_15 | AC | 122 ms
89,940 KB |
testcase_16 | AC | 99 ms
89,332 KB |
ソースコード
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] elif dir[i] == [1, 0]: dir[i] = [0, 1] elif dir[i] == [0, -1]: dir[i] = [-1, 0] else: for i in range(3): if dir[i] == [-1, 0]: dir[i] = [1, 0] elif dir[i] == [1, 0]: dir[i] = [0, -1] elif 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] elif dir[i] == [-1, 0]: dir[i] = [0, 1] elif dir[i] == [0, -1]: dir[i] = [1, 0] else: for i in range(3): if dir[i] == [1, 0]: dir[i] = [-1, 0] elif dir[i] == [-1, 0]: dir[i] = [0, -1] elif 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(now, dir) print(len(st))