結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-21 09:24:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 1,354 bytes |
コンパイル時間 | 1,669 ms |
コンパイル使用メモリ | 174,564 KB |
実行使用メモリ | 13,056 KB |
最終ジャッジ日時 | 2024-07-23 15:26:24 |
合計ジャッジ時間 | 2,625 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; const long long INF = 1001001001; const long long MOD = /**/1000000007;//*/998244353; const double EPS = 1e-10; int main(){ cin.tie(0); ios::sync_with_stdio(false); string s; cin>>s; set<pair<int,int>> st; int y=0,x=0,rev=0; st.insert(make_pair(y,x)); char bot='c',top='d',le='a',ri='b'; for(int i=0;i<s.size();i++){ if(rev==1){ if(s[i]==top){ bot=top; top='d'; y--; }else if(s[i]==le){ char t=le; bot=ri; le=top; ri=t; x--; }else{ char t=ri; bot=le; ri=top; le=t; x++; } }else{ if(s[i]==bot){ top=bot; bot='d'; y++; }else if(s[i]==le){ char t=le; top=ri; le=bot; ri=t; x--; }else{ char t=ri; top=le; ri=bot; le=t; x++; } } rev=1-rev; st.insert(make_pair(y,x)); } cout<<st.size()<<endl; }