結果

問題 No.1292 パタパタ三角形
ユーザー 沙耶花沙耶花
提出日時 2020-03-13 12:59:34
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 2,142 ms
コンパイル使用メモリ 207,736 KB
実行使用メモリ 12,976 KB
最終ジャッジ日時 2023-09-18 01:30:20
合計ジャッジ時間 3,326 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 31 ms
5,236 KB
testcase_08 AC 30 ms
5,132 KB
testcase_09 AC 54 ms
12,344 KB
testcase_10 AC 58 ms
12,456 KB
testcase_11 AC 56 ms
12,276 KB
testcase_12 AC 59 ms
12,692 KB
testcase_13 AC 59 ms
12,976 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:35:25: 警告: ‘ind’ may be used uninitialized [-Wmaybe-uninitialized]
   35 |                         if(ind==1)x++,y--;
      |                         ^~
main.cpp:24:21: 備考: ‘ind’ はここで定義されています
   24 |                 int ind;
      |                     ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	vector<string> T = {"abc","cab","bca"};
	
	string S;
	cin>>S;

	set<pair<int,int>> A;
	
	int x=0,y=0;
	A.insert({x,y});
	
	int now = 0;
	
	for(int i=0;i<S.size();i++){
		int ind;
		for(int j=0;j<3;j++){
			if(T[now][j]==S[i]){
				ind = j;
				break;
			}
		}
		
		now = (now+ind)%3;
		if(i%2==0){
			if(ind==0)x--,y--;
			if(ind==1)x++,y--;
			if(ind==2)y+=2;
		}
		else{
			if(ind==0)x++,y++;
			if(ind==1)y-=2;
			if(ind==2)x--,y++;
		}
		A.insert({x,y});
	}
	
	cout<<A.size()<<endl;
	
	
	return 0;
}
0