結果
問題 | No.1292 パタパタ三角形 |
ユーザー | tsuzuiri |
提出日時 | 2020-11-26 00:03:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 155 ms / 2,000 ms |
コード長 | 1,103 bytes |
コンパイル時間 | 351 ms |
コンパイル使用メモリ | 86,504 KB |
実行使用メモリ | 117,568 KB |
最終ジャッジ日時 | 2023-10-01 02:03:15 |
合計ジャッジ時間 | 2,976 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,060 KB |
testcase_01 | AC | 69 ms
71,160 KB |
testcase_02 | AC | 70 ms
71,160 KB |
testcase_03 | AC | 71 ms
70,596 KB |
testcase_04 | AC | 74 ms
70,912 KB |
testcase_05 | AC | 70 ms
71,216 KB |
testcase_06 | AC | 70 ms
71,148 KB |
testcase_07 | AC | 126 ms
91,372 KB |
testcase_08 | AC | 124 ms
90,376 KB |
testcase_09 | AC | 155 ms
117,352 KB |
testcase_10 | AC | 153 ms
117,292 KB |
testcase_11 | AC | 152 ms
117,568 KB |
testcase_12 | AC | 145 ms
113,068 KB |
testcase_13 | AC | 142 ms
114,384 KB |
testcase_14 | AC | 102 ms
87,128 KB |
testcase_15 | AC | 104 ms
87,212 KB |
testcase_16 | AC | 108 ms
87,360 KB |
ソースコード
def p2(data): inputs=list(data) ref = 0 x=0 y=0 inv=0 history = set() history.add((x,y)) for _in in inputs: if 0==ref: if _in == 'a': if inv: y+=1 else: y-=1 elif _in == 'b': x+=1 ref=2 else: x-=1 ref=1 elif 1==ref: if _in == 'b': if inv: y+=1 else: y-=1 elif _in == 'c': x+=1 ref=0 else: x-=1 ref=2 else: if _in == 'c': if inv: y+=1 else: y-=1 elif _in == 'a': x+=1 ref=1 else: x-=1 ref=0 history.add((x,y)) inv^=1 print(len(history)) from sys import stdin input = stdin.readline p2(list(input().rstrip()))