結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
|
提出日時 | 2021-02-15 20:42:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 82,020 KB |
実行使用メモリ | 105,972 KB |
最終ジャッジ日時 | 2024-07-23 12:27:03 |
合計ジャッジ時間 | 2,624 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
s=input() seen={(0,0)} sts=['a','b','c','u'] # 底辺、右にある辺、左にある辺、三角形下向き上向 now=[0,0] for si in s: if si==sts[0]: if sts[3]=='u': now[1]-=1 else: now[1]+=1 else: if si==sts[1]:# 右に移動 now[0]+=1 sts[0],sts[1],sts[2]=sts[2],sts[0],sts[1] else: now[0]-=1 sts[0],sts[1],sts[2]=sts[1],sts[2],sts[0] seen.add(tuple(now)) if sts[3]=='u':sts[3]='d' else:sts[3]='u' print(len(seen))