結果

問題 No.1292 パタパタ三角形
ユーザー HaaHaa
提出日時 2020-11-20 21:47:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 1,557 ms
コンパイル使用メモリ 172,584 KB
実行使用メモリ 12,924 KB
最終ジャッジ日時 2023-09-30 19:07:04
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=1e18;

int main(){
	string s; cin >> s;
	int n=s.size();
	set<pair<int,int>> st;
	st.insert({0,0});
	string p0[3]={"abc","bca","cab"};
	string p1[3]={"cab","abc","bca"};
	int x=0, y=0;
	REP(i,n){
		int p=((y+600000)/2+x*2+600000)%3;
		if(y%2==0){
			cout << p0[p] << endl;
			if(s[i]==p0[p][0])
				y++;
			else if(s[i]==p0[p][1])
				y--;
			else
				y++,x--;
		}
		else{
			cout << p1[p] << endl;

			if(s[i]==p1[p][0])
				y++;
			else if(s[i]==p1[p][1])
				y--;
			else
				y--,x++;
		}
		//cout << x << ' ' << y << endl;
		//cout << st.count({x,y}) << endl;
		st.insert({x,y});
	}
	cout << st.size() << endl;
	return 0;
}
0