結果
| 問題 | No.1292 パタパタ三角形 | 
| コンテスト | |
| ユーザー |  tsuzuiri | 
| 提出日時 | 2020-11-25 23:59:41 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,128 bytes | 
| コンパイル時間 | 333 ms | 
| コンパイル使用メモリ | 82,000 KB | 
| 実行使用メモリ | 117,404 KB | 
| 最終ジャッジ日時 | 2024-07-23 19:33:47 | 
| 合計ジャッジ時間 | 4,717 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 14 | 
ソースコード
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(ref,' ',x,' ', y)
    print(len(history))
from sys import stdin
input = stdin.readline
p2(input().rstrip())
            
            
            
        