結果

問題 No.1292 パタパタ三角形
ユーザー FF256grhyFF256grhy
提出日時 2020-11-22 12:08:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 209,448 KB
実行使用メモリ 22,168 KB
最終ジャッジ日時 2023-09-30 22:40:40
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 45 ms
7,288 KB
testcase_08 AC 44 ms
7,072 KB
testcase_09 AC 73 ms
21,296 KB
testcase_10 AC 72 ms
21,196 KB
testcase_11 AC 77 ms
21,100 KB
testcase_12 AC 83 ms
22,168 KB
testcase_13 AC 83 ms
22,120 KB
testcase_14 AC 20 ms
4,380 KB
testcase_15 AC 19 ms
4,380 KB
testcase_16 AC 19 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	valarray<int> a = { 0, 0 }, b = { 1, 0 }, c = { 0, 1 }, g = a + b + c;
	set<vector<int>> se;
	se.emplace(begin(g), end(g));
	for(auto e: s) {
		if(e == 'a') { a = b + c - a; }
		if(e == 'b') { b = c + a - b; }
		if(e == 'c') { c = a + b - c; }
		g = a + b + c;
		se.emplace(begin(g), end(g));
	}
	cout << se.size() << endl;
}
0