結果

問題 No.1292 パタパタ三角形
ユーザー madokamadoka
提出日時 2020-11-22 14:16:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 68,176 KB
実行使用メモリ 12,868 KB
最終ジャッジ日時 2023-09-30 22:48:13
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 57 ms
12,724 KB
testcase_13 AC 57 ms
12,868 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 7 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main()
      ^

ソースコード

diff #

#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
string s;
set<pair<int,int> >S;
main()
{
	cin>>s;
	int x=0,y=0;
	string n="abc";
	S.insert(make_pair(x,y));
	for(char t:s)
	{
		if(x%2==0)
		{
			if(n[0]==t)
			{
				x--;
				swap(n[0],n[2]);
			}
			else if(n[1]==t)
			{
				y--;
				swap(n[0],n[1]);
			}
			else
			{
				x++;
				swap(n[1],n[2]);
			}
		}
		else
		{
			if(n[0]==t)
			{
				y++;
				swap(n[0],n[1]);
			}
			else if(n[1]==t)
			{
				x--;
				swap(n[1],n[2]);
			}
			else
			{
				x++;
				swap(n[0],n[2]);
			}
		}
		S.insert(make_pair(x,y));
	}
	cout<<S.size()<<endl;
}
0